Hi,
I'm trying to set global variables for final row of a region of each sheet I have. I have the following code. However, when I debug.print - nothing prints out. Could someone points out my error or how I go about setting global variables that I could reuse in different procedures within the same excel workbook. Thank you!
I'm trying to set global variables for final row of a region of each sheet I have. I have the following code. However, when I debug.print - nothing prints out. Could someone points out my error or how I go about setting global variables that I could reuse in different procedures within the same excel workbook. Thank you!
Code:
Public Sub Initiate()
Set sht_Paste = ThisWorkbook.Worksheets("Paste")
Set sht_2_Wks_Trades = ThisWorkbook.Worksheets("2_Wks_Trades")
Dim finalRow_Paste As Integer
Dim finalRow_2Wks_Trades As Integer
finalRow_Paste = sht_Paste.Cells(sht_Paste.Rows.Count, "a").End(xlUp).Row
finalRow_2_Wks_Trades = sht_2_Wks_Trades.Cells(sht_2_Wks_Trades.Rows.Count, "a").End(xlUp).Row
End Sub
Public Sub test()
Call Initiate
Debug.Print finalRow_Paste
Debug.Print finalRow_2_Wks_Trades
End Sub