I import a large csv file. I know the first column is reliable for counting used rows. Later as columns are added, column A will become column B, C, etc. I need to refer to the last row in probably 20 different modules. and after the first column is inserted, "LastRow" is now in column B, etc.
What I'd like to do is after the csv is imported save the last row as "something", a value in a cell I can reference a named range, so that rather then having to do something similar to the code below everytime I create a new range, put the value of the saved LastRow as the resize to value. Does this make sense? I also set the entire used range as a table if using that is an option.
And after doing that, how do I use it in creating the other new ranges?
TIA
Ron
What I'd like to do is after the csv is imported save the last row as "something", a value in a cell I can reference a named range, so that rather then having to do something similar to the code below everytime I create a new range, put the value of the saved LastRow as the resize to value. Does this make sense? I also set the entire used range as a table if using that is an option.
VBA Code:
Dim LastRow As Long
Dim LastCol As Integer
Dim tbl As Range
Dim ThisWsName As Range
Dim ThisWsNow As Range
'
LastRow = Cells(Cells.Rows.Count, "A").End(xlUp).Row
LastCol = Cells(1, Columns.Count).End(xlToLeft).Column
Range("A1", Cells(LastRow, LastCol)).Name = "ws_2Users1_Tbl"
Range("A1").Name = "ws_2Users1_LogOn"
Range("ws_2Users1_LogOn").Offset(1, 0).Resize(LastRow).Name = "ws_2Users1_RngLogOn"
TIA
Ron