How do I identify the row just below a range I have selected

I'm sure this is trivial for someone who knows VBA.  Say I have a selection which happens to be Rows("5:50").  I want to be able to select the entire row direction after that Rows("51:51").  The numbers 5 and 50 are (of course) arbitrary.  Can someone help fill this gap in my knowledge?

Thanks!
-Dave
JediBeckerAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

William ElliottSr Tech GuruCommented:
not sure why you would do such a thing.. if you already know the 5:50, then you shoudl be able to plug in the '50+1' value at the same time as opposed to finding a way to plug it in afterwards.
0
Jorge PaulinoIT Pro/DeveloperCommented:
Try this way:

    Dim rg As Range
    Set rg = Selection
   
    lastcolumn = rg.Columns(rg.Columns.Count).Column + 1
    Columns(lastcolumn).Select
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Malik1947Commented:
You can find the current value of the selected row by simply accessing the following code

To select the following row increment the number by One and then select the whole row below
' Selected Row Value
Selection.Row
 
Dim NextRow as Range
Dim LastCol as Integer
 
LastCol = Cells.Find("*", SearchOrder:=xlByRows, SearchDirection:xlPrevious).Column
 
Set NextRow  = Cells(Selection.Row, LastColumn).EntireRow

Open in new window

0
Determine the Perfect Price for Your IT Services

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden with our free interactive tool and use it to determine the right price for your IT services. Download your free eBook now!

JediBeckerAuthor Commented:
Thanks, jpaulino.  Just what I was looking for.
0
JediBeckerAuthor Commented:
Thanks for all the input.  Malik -- I didn't even see your until I posted the acceptance, but thanks for the input.  jpaulino's answer did just what I want (aside from being for columns instead of rows :)

Thanks,
-Dave
0
Jorge PaulinoIT Pro/DeveloperCommented:
LOL, I read rows and I type columns. Almost midnight in Portugal. :-)

Thanks for the grade!
0
Malik1947Commented:
that's why I posted mine. Mine works for the Rows not for the columns.
0
Jorge PaulinoIT Pro/DeveloperCommented:
Just for the record. The method is the same, just replace the column with row

Dim rg As Range
Set rg = Selection

lastrow = rg.Rows(rg.Rows.Count).Row + 1
Rows(lastrow).Select
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.