Stop Highlighting a Range

C

Chris Gorham

Hi,

I'm writing a macro that will improve on Excel's graph
plotting routine by automating some of the steps. As part
of it I would like to have the user select a row by
clicking on it.

No problem - I can do that:

Set activecell_position = Application.InputBox
(prompt:="Input desired active cell position",
title:="Active Cell Position",
Default:=ActiveCell.Address, Type:=8)

but what I would like to do is to prevent a range of cells
being highlighted accidentally.
ok, I know its still the active cell address that's read
in - but I want to prevent the highlighting of the range
in the first place.

Thks....Chris
 
T

Tom Ogilvy

Set activecell_position = Application.InputBox
(prompt:="Input desired active cell position",
title:="Active Cell Position",
Default:=ActiveCell.Address, Type:=8)

set ActiveCell_position = activeCell_Position(1,1)
 
C

Chris Gorham

Sorry Tom,

still doesn't do what I want....
in the Input Box you can still drag across a range...yes I
know that the active cell is still read in correctly, but
I'm trying to prevent the user from selecting a range when
he doesn't need to. My macro will read in the information
from the range automatically - all he has to do is "click"
on the row that contains it, not highlight the range where
the info is contained...

Thks...Chris
 
T

Tom Ogilvy

Unless you want to protect the worksheet and restrict the ability to select
to a single column or certain set of cells, there would be no way of
restricting the user to what can be selected. You just have to adjust to
what is selected and acertain the user's intent in the context of what you
asked for. You could certainly reject any selection that was greater than
one cell and put the inputbox back up with a chastising message.
 
T

Tom Ogilvy

Just an added thought - selecting with the inputbox does not change the
current selection/activecell - you seem to keep insinuating that it does.
...yes I
know that the active cell is still read in correctly,

There is no ActiveCell associated with making a selection using the
Application.InputBox. The default is the current selection, but then there
would be no reason to put up the inputbox if that is what you wanted.
 

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

Top