Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Find value in a cell

Status
Not open for further replies.

neepshed

IS-IT--Management
Aug 17, 2002
27
0
0
GB
I need to search a cell for a particular value and based on whether the value is present I need to perform an action.

What is the best way of searching a cell for a determined value.

This search will be done row by row in the spreadsheet. So I dont want to specify the entire spreadsheet range.

Thanks.
 
Set objExcel = CreateObject("Excel.Application")
objExcel.Visible = True 'if you want to see the app?
Set objWorkbook = objExcel.Workbooks.Add()
Set objWorksheet = objWorkbook.Worksheets(1)

objExcel.Cells(1, 1).Value = "A"
for i = 1 to some_nbr ' nbr of rows?
for j = 1 to some_other_nbr ' nbr of columns?
if objExcel.Cells(i,j) = "something" then
MsgBox "found the value"
end if
next
next
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top