Loop excel formula

  • Thread starter Thread starter magix
  • Start date Start date
M

magix

Hi,

I need to loop through
A1, B1, C1, D1
- then do some IF checking

Is there a FOR excel formula ? Or is there a better way ?

Thanks.
 
Dim myRng as range
dim myCell as range

with worksheets("sheet9999")
set myrng = .range("a1:D1")
end with

for each mycell in myrng.cells
if mycell.value = "hi" then
msgbox "It said hi!"
else
msgbox "No it didn't"
end if
next mycell
 
Back
Top