P
Piranha
Hi,
This code was posted by Norman Jones i believe. It works great.
Code
-------------------
Sub test()
Cells(LastRow(ActiveSheet) + 1, "A").Value = "Hi this is one row below the Last Used Row"
End Sub
Function LastRow(sh As Worksheet)
On Error Resume Next
LastRow = sh.Cells.Find(What:="*", _
After:=sh.Range("A1"), _
Lookat:=xlPart, _
LookIn:=xlFormulas, _
SearchOrder:=xlByRows, _
SearchDirection:=xlPrevious, _
MatchCase:=False).Row
On Error GoTo 0
End Functio
-------------------
I tried to change it for Columns instead of Rows. what am i doin
wrong?
Code
-------------------
Sub test()
Cells(LastCol(ActiveSheet) + 1, "A").Value = "Hi this is one column past the Last Used Column"
End Sub
Function LastCol(SH As Worksheet)
On Error Resume Next
LastColumn = SH.Cells.Find(What:="*", _
After:=SH.Range("A1"), _
Lookat:=xlPart, _
LookIn:=xlFormulas, _
SearchOrder:=xlByColumns, _
SearchDirection:=xlPrevious, _
MatchCase:=False).Column
On Error GoTo 0
End Functio
This code was posted by Norman Jones i believe. It works great.
Code
-------------------
Sub test()
Cells(LastRow(ActiveSheet) + 1, "A").Value = "Hi this is one row below the Last Used Row"
End Sub
Function LastRow(sh As Worksheet)
On Error Resume Next
LastRow = sh.Cells.Find(What:="*", _
After:=sh.Range("A1"), _
Lookat:=xlPart, _
LookIn:=xlFormulas, _
SearchOrder:=xlByRows, _
SearchDirection:=xlPrevious, _
MatchCase:=False).Row
On Error GoTo 0
End Functio
-------------------
I tried to change it for Columns instead of Rows. what am i doin
wrong?
Code
-------------------
Sub test()
Cells(LastCol(ActiveSheet) + 1, "A").Value = "Hi this is one column past the Last Used Column"
End Sub
Function LastCol(SH As Worksheet)
On Error Resume Next
LastColumn = SH.Cells.Find(What:="*", _
After:=SH.Range("A1"), _
Lookat:=xlPart, _
LookIn:=xlFormulas, _
SearchOrder:=xlByColumns, _
SearchDirection:=xlPrevious, _
MatchCase:=False).Column
On Error GoTo 0
End Functio