Make a macro run on rows/columns only if data is present?
You can build If .... Then....Else....End IF statements that check the cells
Dim cel as range
If len(cel)0 then
' cell is not blank
' do something
End if
If cel = 0 then
' cell has no value except 0
' don't do anything
Else
'do something
End if
And you can put one or more of those statements into a For .. Next loop
For each cel in Range("A1:Z55") ''' change the range to suit your needs
' your code
Next
There are other ways of restricting the ranges that make it even easier.
But we need to know more about what you really have and what you really are
looking at...
--
steveB
Remove "AYN" from email to respond
"bpreas - ExcelForums.com" wrote in
message ...
How can I mave a macro run on fields where there is data present and
ignore empty rows or columns. I have macros that I use regularly, but
the number of rows of data in these spreadsheets varies each time.
Thanks in advance for any help you can provide!
|