Hi,
I tried to set up a Public variable and make it's value available every time I call it in the same project.
But the setup below makes me run the macros every time I want the value of srow_b1, instead of running only once and srow_b1 will avail until the session is closed, which is what I want.
Here is part of the code:
Public srow_b1 As Long
Sub DeclareBeigeRows(rnum As Long, dumrowname)
Sheets("a").Activate
Range("a2").Activate
totalrows = ActiveSheet.UsedRange.Rows.Count
Do Until ActiveCell.Row > totalrows
Do While ActiveCell.Interior.ColorIndex = 36
ActiveCell.Offset(1, 0).Activate
Loop
ActiveCell.Offset(1, 0).Activate
If ActiveCell.Interior.ColorIndex = 36 And ActiveCell.Row < rnum Then dumrowname = ActiveCell.Row
Loop
End Sub
Public Sub dummies()
DeclareBeigeRows 100, srow_b1
End Sub
Thanks in advance.
I tried to set up a Public variable and make it's value available every time I call it in the same project.
But the setup below makes me run the macros every time I want the value of srow_b1, instead of running only once and srow_b1 will avail until the session is closed, which is what I want.
Here is part of the code:
Public srow_b1 As Long
Sub DeclareBeigeRows(rnum As Long, dumrowname)
Sheets("a").Activate
Range("a2").Activate
totalrows = ActiveSheet.UsedRange.Rows.Count
Do Until ActiveCell.Row > totalrows
Do While ActiveCell.Interior.ColorIndex = 36
ActiveCell.Offset(1, 0).Activate
Loop
ActiveCell.Offset(1, 0).Activate
If ActiveCell.Interior.ColorIndex = 36 And ActiveCell.Row < rnum Then dumrowname = ActiveCell.Row
Loop
End Sub
Public Sub dummies()
DeclareBeigeRows 100, srow_b1
End Sub
Thanks in advance.