Pass Info Between Macros (Re-Visited)
Rob wrote:
Hello, The last time I posted this question the Suggestion didn't work and I
didn't get much more help so I'm re-asking for help.
I have a Dim that us the same in multiple macros shown below
Dim RowID
RowID = ActiveCell.Row
How do I use the same RowID in the Original Sub and when it's done running
it passes the same value of RowID to the next sub?
Originating Sub - InsertSection()
2nd Sub - SetBorders()
3rd Sub - InsertFormulas()
4th Sub - AddText()
5th Sub - SetColors()
6th Sub - ConditionalFormatting()
7th Sub - SetNames()
There's more but you get the point. All of them start off with the very same
Dim shown above and they all end with the same Range Selection
Range("A" & RowID).Select
Any help would be awesome.
Thanks in Advance.
Rob
Hi Rob,
It appears that you are wanting to use a variable to handle the RowID
which will be based on the active cell and will not be constant. If
this is the case, then you could assign the row number to the variable
in the first procedure and pass that value along to the next procedure.
I apologize in advance if I have misunderstood your question but
here's what I would do . . .
Sub getRowNumber
dim myRow as long
myRow = ActiveCell.Row
'now we can send this value along to the next procedure
'by using the variable as an argument in the calling procedure
Call nextProcedure(myRow)
End Sub
Sub nextProcedure(myRow)
MsgBox myRow 'just to visually see the row number for validation
Range("A",myRow).Select
End Sub
Does this help or have I misunderstood the question?
|