Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Excel: using a variable to define a cell 1

Status
Not open for further replies.

kristeenj

Technical User
May 24, 2000
8
CA
I am trying to find a way to run a macro on an indefinite number of rows. The macro checks to see if the value in the cell is zero, if it isn't, then it completes the calculation. Is there a way to use a variable to define a cell?
 
This code will check for NUMBERS in column B. If other than numbers, you can easily modify.


For IntR = 13 To 9999 ' Start at row 13

If ActiveSheet.Rows(IntR).Columns(2) <> 0 Then ' Column B (#2) will be checked

' Perform calculation now. For example, enter a date in column C :

ActiveSheet.Rows(IntR).Columns(3) = Int(Now())

Else

' Do nothing

End If

Next IntR

Range(&quot;B13&quot;).Select

End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top