VBA: Offset question

  • Thread starter Thread starter maxifire
  • Start date Start date
M

maxifire

Hi,

I am having problem using the Offset property in VBA.

Say if I'd like to select the cell on the right next to the curren
active cell, I'd use:

ActiveCell.Offset(0, 1)

In my case, I'd like to select the cell on the LEFT next to the curren
active cell. What's the code that I should use? I've tried:

ActiveCell.Offset(0, -1) but it gives me an error.

Please help.


Thank you!


Regards,
Kennet
 
Hi
ActiveCell.Offset(0, 1)
is IMHO correct.
Try
ActiveCell.Offset(0, 1).select
in the immediate window and look which cell is selected
 
ActiveCell.Offset(0, -1) will give an error if the activecell is in
column A - there are no cells to the left. Otherwise it works fine.
 
That will return the value in the cell to the right, not the left.
 
Hi JE
did not read carefully enough. Thought the OP had problems with
referencing the right cell.
Agree with you that
..offset(0,-1) will not work if the active cell is in column A :-)
 

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

Similar Threads


Back
Top