Finding the first non-blank cell in a row and then applying a calculation
somthing like this will loop through a range, then stop and perform a
calculation when a non-blank cell is encountered.
Sub findFirstNonBlankCell()
Dim myRange As Range
Dim myVar As Range
Set myRange = Range("A2:A10") 'set range
'begin loop
For Each myVar In myRange
Set nextVar = myVar.Offset(1, 0)
If myVar = "" Then 'test to see if cell is
empty
Set myVar = nextVar 'proceed to next cell if empty
Else 'else perform a
calc.
myVar.Value = myVar * 2 'peform a calucation
End If
Next
End Sub
|