excel vba last row excel vba last column with data excel vba last column in range vba find last column in a row with data

The solution for “excel vba last row excel vba last column with data excel vba last column in range vba find last column in a row with data” can be found here. The following code will assist you in solving the problem.

Dim rRange As Range
Dim rDuplicate As Range

Set rRange = ActiveSheet.UsedRange
lFirstRow = rRange.Row
lLastRow = rRange.Rows.Count + rRange.Row – 1
lFirstColumn = rRange.Column
lLastColumn = rRange.Columns.Count + rRange.Column – 1
‘ New reference to current range (can be resized / moved)
Set rDuplicate = Range(Cells(lFirstRow, lFirstColumn), _
Cells(lLastRow, lLastColumn))Dim rLastCell As Range

Set rLastCell = ws.Cells.Find(What:=”*”, After:=ws.Cells(1, 1), _
LookIn:=xlFormulas, LookAt:= xlPart, SearchOrder:=xlByColumns, _
SearchDirection:=xlPrevious, MatchCase:=False)

MsgBox (“The last used column is: ” & rLastCell.Column)Dim rRange As Range
Dim rDuplicate As Range

Set rRange = ActiveSheet.UsedRange
lFirstRow = rRange.Row
lLastRow = rRange.Rows.Count + rRange.Row – 1
lFirstColumn = rRange.Column
lLastColumn = rRange.Columns.Count + rRange.Column – 1
‘ New reference to current range (can be truncated)
Set rDuplicate = Range(Cells(lFirstRow, lFirstColumn), _
Cells(lLastRow, lLastColumn))Select All
last_col = Cells(1, Columns.Count).End(xlToLeft).Column

Thank you for using DeclareCode; We hope you were able to resolve the issue.

More questions on [categories-list]

Similar Posts