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 resized / moved)
Set rDuplicate = Range(Cells(lFirstRow, lFirstColumn), _
      Cells(lLastRow, lLastColumn))

3.75
4
Krish 100200 points

                                    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.75 (4 Votes)
0
Are there any code examples left?
Create a Free Account
Unlock the power of data and AI by diving into Python, ChatGPT, SQL, Power BI, and beyond.
Sign up
Develop soft skills on BrainApps
Complete the IQ Test
Relative searches
vba last row in column vba last cell in a range looking for the last row vba excel vba usedrange last row vba last row in case of table get last row of a sheet vba excel vba last column vba set last column in range excel vba find last row find last row vba vba last row entry last row for a specific sheet vba find last row in named range vba last row vba xlup last row + 1 vba numbe last row + 1 vba last row with data in excel vba vba get last row with data get last filled row vba excel vba dynamic range last row vba last row with values vba get last cell in range vba find the last row last row in column excel vba vba Using first row Last row and Last column to reference a sheets range vba Using first row Last row and Last column to reference a range the first row and last row in a selection vba the first row and last row n a selection vba get value from last row excel vba excel vba find last function set range excel vba get last row vba select the last column in a row vba select the last cell in a row vba get the first and last column from named range vba find last row last row in vba vba excel how to find last row with data get last row in column vba vba last cell in range vba range end last cell vba excel find last row vba set last row vba last cell in column +1 vba last used row last row vba vba last row vba dynamic range last row excel vba cells range last row up vba find last row set range range cell and last filled in excel vba last row select vba vba last row with data excel vba last row with value in column get last row in vba exdel vba get last row RANGE A1 TO LAST ROW VBA how to get last row of data sheet with VBA excel get the last column count get last row vba excel vba last row excel vba last row in range excel vba first and last row and column in range
Made with love
This website uses cookies to make IQCode work for you. By using this site, you agree to our cookie policy

Welcome Back!

Sign up to unlock all of IQCode features:
  • Test your skills and track progress
  • Engage in comprehensive interactive courses
  • Commit to daily skill-enhancing challenges
  • Solve practical, real-world issues
  • Share your insights and learnings
Create an account
Sign in
Recover lost password
Or log in with

Create a Free Account

Sign up to unlock all of IQCode features:
  • Test your skills and track progress
  • Engage in comprehensive interactive courses
  • Commit to daily skill-enhancing challenges
  • Solve practical, real-world issues
  • Share your insights and learnings
Create an account
Sign up
Or sign up with
By signing up, you agree to the Terms and Conditions and Privacy Policy. You also agree to receive product-related marketing emails from IQCode, which you can unsubscribe from at any time.
Creating a new code example
Code snippet title
Source