Assign a value to a variable by next selected cell?

B

Brad

I am using the following VBA code line in Excel 2003 to prompt for a symbol:

UserVal = UCase(Application.InputBox("Symbol?", , MyLastSymbol, , , , , 2))

and it works fine. The "MyLast Symbol" places a defaulted value there for me
to accept automatically or change the input.

But, I have an occasion where what I really need is to prompt for a value to
be assigned to a variable based on the next selected cell I would click on.

If I could combine this with the InputBox format, that would be great.

My thanks in advance for any suggestions.

Brad
 
B

Bernie Deitrick

Brad,

Use 10 (8, for range selection, + 2, for string, (either can be used, then)
as the last parameter of your imputbox...

UserVal = UCase(Application.InputBox("Symbol? Type or select a cell", ,
MyLastSymbol, , , , , 10))

HTH,
Bernie
MS Excel MVP
 
B

Brad

Well, I don't but the cell I will be looking for will be from a column of
index values. Once the index number is assigned via this operation to a
variable, it will determine the input range for a chart.

Thanks, Brad
 

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