View Single Post
  #1   Report Post  
needyourhelp
 
Posts: n/a
Default syntax question - cell references in VB code

Given the following code (found on this site..)

With ActiveSheet.Range("B:B")
Set FoundCell = .Find(what:="whatever", _
after:=.Cells(.Cells.Count), _
LookIn:=xlFormulas, LookAt:=xlPart, _
SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False)
End With

How do I tell VB to look in Cell H1 for the what:="whatever" ?

ie. I want to use the value found in the Cell H1 not the text "whatever"

I've tried every combination of H1, H1:H1, $H1, Range(H1), Range(H1:H1),
Range("H1"),etc....

All generate compile errors, syntax errors, or runtime errors....

Forgive the simple question, but I'm not VB literate and I don't have a
manual handy.