I Need VBA Assistance Please

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Good afternoon,

I am using an Access module to control Excel and I need to know a VBA
command that will increment thru and look at all cells in Column B on an
Excel worksheet until
end of file or EOF. I tried DO UNTIL ... EOF, but didn't seem to work. Any
suggestions? Thanks.
 
This code assumes you're using early binding... if you're using late
binding, modify accordingly.

Dim xlRng As Excel.Range
For Each xlRng in Excel.Application.Workbooks(1).Worksheets(1).Range("B:B")
' search the value of the cell
If xlRng.Value = "My target value" Then
' code here
End If
Next xlRng
Set xlRng = Nothing
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top