In this article we will learn about some of the frequently asked Visual Basic programming questions in technical like “excel vba last row in range” Code Answer. When creating scripts and web applications, error handling is an important part. If your code lacks error checking code, your program may look very unprofessional and you may be open to security risks. Error handling in VBA is simple. An error message with filename, line number and a message describing the error is sent to the browser. This tutorial contains some of the most common error checking methods in Visual Basic. Below are some solution about “excel vba last row in range” Code Answer.
excel vba last row in range
xxxxxxxxxx
1
Dim rRange As Range
2
Dim rDuplicate As Range
3
4
Set rRange = ActiveSheet.UsedRange
5
lFirstRow = rRange.Row
6
lLastRow = rRange.Rows.Count + rRange.Row - 1
7
lFirstColumn = rRange.Column
8
lLastColumn = rRange.Columns.Count + rRange.Column - 1
9
' New reference to current range (can be resized / moved)
10
Set rDuplicate = Range(Cells(lFirstRow, lFirstColumn), _
11
Cells(lLastRow, lLastColumn))