[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 642
  • Last Modified:

Last Row of currentRegion - How

Hello All,

Get the last Row of current Region
I have several current regions in my sheet.

What I need: I need the last row number of the current region…..
sheet1.range(“BB2”).currentregion.lastrow?
0
Rayne
Asked:
Rayne
3 Solutions
 
tdlewisCommented:
Assuming that "sheet1" is a variable you have defined then the code below will work, but you might have meant Sheets("Sheet1") instead; if so, make that substitution.
Dim rgn As Range
    Set rgn = sheet1.Range(“BB2”).CurrentRegion
    lastRow = rgn.Row + rgn.Rows.Count - 1

Open in new window

0
 
Elton PascuaCommented:
Worksheets("Sheet1").Range("BB2").CurrentRegion.Rows.Count
0
 
andrewssd3Commented:
techfanatic's answer will only work if the current region starts in row 1. Not for points, but I usually use a variant of tdlewis:
Dim rgn As Range
    Set rgn = Sheet1.Range("BB2").CurrentRegion
    lastrow = rgn.Rows(rgn.Rows.Count).Row

Open in new window

0
 
RayneAuthor Commented:
Thank you all :)
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now