Horje
excel vba last row Code Example
excel vba last row
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))
excel vba last column with data
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)
excel vba first and last row and column in range
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))




3

Related
xlvba double quotes in string literal Code Example xlvba double quotes in string literal Code Example
excel formula how to create strings containing double quotes Code Example excel formula how to create strings containing double quotes Code Example
vba how to convert a column number into an Excel column Code Example vba how to convert a column number into an Excel column Code Example
excel vba copy entire sheet paste values Code Example excel vba copy entire sheet paste values Code Example
xl vba double quotes in string literal Code Example xl vba double quotes in string literal Code Example

Type:
Code Example
Category:
Coding
Sub Category:
Code Example
Uploaded by:
Admin
Views:
10