business_analyst
Board Regular
- Joined
- Jun 5, 2009
- Messages
- 99
Hell All,
So I would like to look through a range of cells on a sheet to check if they have numbers in them. Basically it is a sheet with 4 columns (A through D). And 10 rows (2 through 11). I would like to loop through all four columns, and check that same row range for each column. The code below does this for the first row of each column. But how to I check all the rows for each column? I cannot insert a range into the sheet1.cells property can I? And I do not know how to use the range property with cell indexes. Any help would be greatly appreciated.
So I would like to look through a range of cells on a sheet to check if they have numbers in them. Basically it is a sheet with 4 columns (A through D). And 10 rows (2 through 11). I would like to loop through all four columns, and check that same row range for each column. The code below does this for the first row of each column. But how to I check all the rows for each column? I cannot insert a range into the sheet1.cells property can I? And I do not know how to use the range property with cell indexes. Any help would be greatly appreciated.
Code:
dim row as integer
dim col as integer
col = 1
row = 2
For col = 1 to 4
If sheet1.cells(row, col) = 0 then
Msgbox "The range is equal to 0"
end if
next col