ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Loop excel formula (https://www.excelbanter.com/excel-programming/389312-loop-excel-formula.html)

magix

Loop excel formula
 
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.



Don Guillett

Loop excel formula
 
A more detailed explanation with example of before/after

--
Don Guillett
SalesAid Software

"magix" wrote in message
...
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.



Dave Peterson

Loop excel formula
 
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



magix wrote:

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.


--

Dave Peterson


All times are GMT +1. The time now is 10:43 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com