在excel文件中搜索 [英] searching in excel file

查看:95
本文介绍了在excel文件中搜索的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Hello Everyone, 


我试图搜索名为"excel"的excel文件试验"对于名称,例如用户在excel文件中键入名字和Visual Studio搜索它,并在网格视图上给我结果。 


到目前为止我所拥有的是表单,名字文本框,姓氏,文本框,网格视图和加载按钮


请尽快帮助我


谢谢 

解决方案


Sub TestMacro()

Dim C As范围

Dim W As Workbook

Dim S As Worksheet

Dim N As String



N = Me.TextBox1.Text



设置W =工作簿("Test.xls")

每个S In W.Worksheets

设置C = S.Cells.Find(N)

如果不是C则什么都没有那么¥b $ b MsgBox N& "被发现在" &安培; S.Name& "在单元格中&安培; C.地址(假,假)

结束如果

下一个S



结束次级


Hello Everyone, 

i was trying to search in excel file called " test" for name, so for example the user type the first name and Visual Studio search for it in the excel file and give me the result on grid view. 

what i have so far is the form , first name textbox , last name, textbox ,grid view and load button

plz help me ASAP

THANKS 

解决方案

Sub TestMacro()
Dim C As Range
Dim W As Workbook
Dim S As Worksheet
Dim N As String

N = Me.TextBox1.Text

Set W = Workbooks("Test.xls")
For Each S In W.Worksheets
Set C = S.Cells.Find(N)
If Not C Is Nothing Then
MsgBox N & " was found on " & S.Name & " in cell " & C.Address(False, False)
End If
Next S

End Sub


这篇关于在excel文件中搜索的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆