Can VBA read the row-col location of a selected cell?

  • Thread starter Thread starter news.bcentral.com
  • Start date Start date
N

news.bcentral.com

I am trying to assign the row and column of a selected excel cell to a
variable name, then return from the VBA procedure to the cell directly below
that cell...without much luck.
Can anybody help?
Thanks...James Hill
 
Hi

selection.row and selection.column will give you the information you need
Anyway, you can reach the cell below by writing the instruction below if you
are on the activecell

activecell.offset(1,0).select

Regards
 
Dim rng as Range
Dim rw as Long, col as Long
Dim sStr as String

You can set a reference to the cell,
set rng = ActiveCell
rng.offset(1,0).Select
You can use two variable to hold the row and column
rw = ActiveCell.Row
col = activeCell.Column
cells(rw+1,col).Select
You can use one variable to hold the address.
sStr = ActiveCell.Address()
Range(sStr).Offset(1,0).Select

Or if you just want to select the cell below

ActiveCell.Offset(1,0).Select
 
try using the .offset property

Example:
Dim Cell As Range
Set Cell = ActiveCell.Offset(1, 0)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top