Input box display

S

Slim Slender

I'm using an input box to gather a condition for a macro. I found out
that I could click in a cell containing the needed data as well as
typing in the input box. When I click on a cell the input box displays
the cell reference rather than the cell content. Is there a way to
have the input box display the content, for example 1/27/2011, rather
than the reference =$E$238, for example?
 
G

GS

Slim Slender presented the following explanation :
I'm using an input box to gather a condition for a macro. I found out
that I could click in a cell containing the needed data as well as
typing in the input box. When I click on a cell the input box displays
the cell reference rather than the cell content. Is there a way to
have the input box display the content, for example 1/27/2011, rather
than the reference =$E$238, for example?

This suggests you're using Excel's InputBox method rather than VBA's
InputBox function. In this case, selecting cells is possible because
the control is actually a refedit and so will return the selection
address. That said, to get the cell contents you can use the address in
the normal fashion:

sMyVal = Application.InputBox... '//get cell reference
sMyVal = Range(sMyVal).Value '//replace with contents

HTH
 

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