Set End Row (iRe1) + End Col(iCe1)
Call function method: Option 1
Dim iRe1 as long, iCe1 as long
iRe1 = Range(GetLastCell(Ws1)).Row
iCe1 = Range(GetLastCell(Ws1)).Column
Call function method: Option 2
Dim sAddress as string
Dim iRe1 as long, iCe1 as long
sAddress = Range(GetLastCell(Ws1))
iRe1 = Range(sAddress).Row
iCe1 = Range(sAddress).Column
Dim iRe1 as long, iCe1 as long
iRe1 = Range(GetLastCell(Ws1)).Row
iCe1 = Range(GetLastCell(Ws1)).Column
Call function method: Option 2
Dim sAddress as string
Dim iRe1 as long, iCe1 as long
sAddress = Range(GetLastCell(Ws1))
iRe1 = Range(sAddress).Row
iCe1 = Range(sAddress).Column
End Row/Column Method
iRe1 = Worksheets(Ws1).Cells(1048576, 1).End(xlUp).Row
iCe1 = Worksheets(Ws1).Cells(1, 300).End(xlToLeft).Column
iRe1 = Worksheets(Ws1).Cells(1048576, 1).End(xlUp).Row
iCe1 = Worksheets(Ws1).Cells(1, 300).End(xlToLeft).Column
Function...
Function GetLastCell(myWs As Long) As String
Dim iRe1 As Long, iCe1 As Long, iLoop As Long, iTempR As Long, iTempC As Long
iRe1 = 0: iCe1 = 0
iTempC = 0
For iLoop = 1 To 300
iTempC = Worksheets(myWs).Cells(iLoop, Columns.Count).End(xlToLeft).Column
If iTempC > iCe1 Then
iCe1 = iTempC
iTempR = Worksheets(myWs).Cells(Rows.Count, iCe1).End(xlUp).Row
If iTempR > iRe1 Then iRe1 = iTempR
End If
Next iLoop
iTempR = 0
For iLoop = 1 To 300
iTempR = Worksheets(myWs).Cells(Rows.Count, iLoop).End(xlUp).Row
If iTempR > iRe1 Then
iRe1 = iTempR
iTempC = Worksheets(myWs).Cells(iRe1, Columns.Count).End(xlToLeft).Column
If iTempC > iCe1 Then iCe1 = iTempC
End If
Next iLoop
If iRe1 = 0 Then iRe1 = 1
If iCe1 = 0 Then iCe1 = 1
GetLastCell = Cells(iRe1, iCe1).Address
End Function
Dim iRe1 As Long, iCe1 As Long, iLoop As Long, iTempR As Long, iTempC As Long
iRe1 = 0: iCe1 = 0
iTempC = 0
For iLoop = 1 To 300
iTempC = Worksheets(myWs).Cells(iLoop, Columns.Count).End(xlToLeft).Column
If iTempC > iCe1 Then
iCe1 = iTempC
iTempR = Worksheets(myWs).Cells(Rows.Count, iCe1).End(xlUp).Row
If iTempR > iRe1 Then iRe1 = iTempR
End If
Next iLoop
iTempR = 0
For iLoop = 1 To 300
iTempR = Worksheets(myWs).Cells(Rows.Count, iLoop).End(xlUp).Row
If iTempR > iRe1 Then
iRe1 = iTempR
iTempC = Worksheets(myWs).Cells(iRe1, Columns.Count).End(xlToLeft).Column
If iTempC > iCe1 Then iCe1 = iTempC
End If
Next iLoop
If iRe1 = 0 Then iRe1 = 1
If iCe1 = 0 Then iCe1 = 1
GetLastCell = Cells(iRe1, iCe1).Address
End Function