Logo 
Search:

MS Office Answers

Ask Question   UnAnswered
Home » Forum » MS Office       RSS Feeds
  Question Asked By: Holly Fox   on Mar 25 In MS Office Category.

  
Question Answered By: Latoya Murray   on Mar 25

I'm confused with your code. You added three statements that are
selecting a cell  and so that's the address it's returning which makes
sense. It's rarely needed to specifically select/activate a cell and
the macro  recorder does that a lot.

From your code:
ActiveCell.Activate ' These three don't enlighten the macro.
ActiveCell.Cells.Activate
ActiveCell.Cells.Select

These do nothing since 'activecell' is where the current cell (the
one where you can enter data) so it's already active. Selecting a
cell doesn't necessarily make it active.

In my own tests, I created a sheet with two panes, data in each pane.
Then in the IDE immediate window  (ctrl+g), I do '?activecell.address'
and get the correct  address for the cell which is activate no matter
what pane  it is in. There is only one activecell  per sheet. The panes
collection just tells you how many panes you have and the addresses
of cells in that pane.

What's the object  of your code, it's not clear since it's doing
exactly as it's written. Let's start over by asking what you're
trying to do. You have two panes in a single sheet and you want code
that does what???

?activewindow.panes(1).VisibleRange.Address

This returns  the cells that are in pane #1 (left most). There is
nothing in the panes collection that would limit how you read a cell.

Share: 

 

This Question has 3 more answer(s). View Complete Question Thread

 
Didn't find what you were looking for? Find more on Cell reference/pane errors Or get search suggestion and latest updates.


Tagged: