Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
[color blue]Sub[/color] FindUsedRange()
[color blue]Dim[/color] LastRow [color blue]As Long
Dim[/color] FirstRow [color blue]As Long
Dim[/color] LastCol [color blue]As Integer
Dim[/color] FirstCol [color blue]As Integer[/color]
[color green]' Find the FIRST real row[/color]
FirstRow = ActiveSheet.Cells.Find(What:="*", _
SearchDirection:=xlNext, _
SearchOrder:=xlByRows).Row
[color green]' Find the FIRST real column[/color]
FirstCol = ActiveSheet.Cells.Find(What:="*", _
SearchDirection:=xlNext, _
SearchOrder:=xlByColumns).Column
[color green]' Find the LAST real row[/color]
LastRow = ActiveSheet.Cells.Find(What:="*", _
SearchDirection:=xlPrevious, _
SearchOrder:=xlByRows).Row
[color green]' Find the LAST real column[/color]
LastCol = ActiveSheet.Cells.Find(What:="*", _
SearchDirection:=xlPrevious, _
SearchOrder:=xlByColumns).Column
[color green]'Select the ACTUAL Used Range as identified by the
'variables identified above[/color]
ActiveSheet.Range(Cells(FirstRow, FirstCol), _
Cells(LastRow, LastCol)).Select
[color blue]End Sub[/color]
[color blue]Sub[/color] MIT()
[color blue]Dim[/color] lRow [color blue]As Long[/color]
[color green]' Find the FIRST EMPTY row by adding 1 to the last row[/color]
lRow = ActiveSheet.Cells.Find(What:="*", _
SearchDirection:=xlPrevious, _
SearchOrder:=xlByRows).Row [b]+ 1[/b]
[color green]'Paste the data into the first
'COMPLETELY empty row[/color]
ActiveSheet.Paste Destination:=Cells(lRow, 1)
[color blue]End Sub[/color]