PC Review


Reply
Thread Tools Rate Thread

Assign a value to a variable by next selected cell?

 
 
Brad
Guest
Posts: n/a
 
      22nd Jul 2008
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


 
Reply With Quote
 
 
 
 
Wigi
Guest
Posts: n/a
 
      22nd Jul 2008
How do you know on which cell you will click next?


--
Wigi
http://www.wimgielis.be = Excel/VBA, soccer and music


"Brad" wrote:

> 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
>
>
>

 
Reply With Quote
 
Bernie Deitrick
Guest
Posts: n/a
 
      22nd Jul 2008
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


"Brad" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
>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
>



 
Reply With Quote
 
Brad
Guest
Posts: n/a
 
      22nd Jul 2008
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


"Wigi" <(E-Mail Removed)> wrote in message
news:1DAD9FE6-65AC-41CA-9BA7-(E-Mail Removed)...
> How do you know on which cell you will click next?
>
>
> --
> Wigi
> http://www.wimgielis.be = Excel/VBA, soccer and music
>
>
> "Brad" wrote:
>
>> 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
>>
>>
>>



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
how to assign contents of a cell to a macro variable =?Utf-8?B?RGF2aWRI?= Microsoft Excel Programming 3 20th Aug 2007 07:10 PM
Assign multiple cell's values to a variable mikeburg Microsoft Excel Programming 2 27th Jul 2006 06:41 PM
How do I assign the value in a cell to a variable? JasonK Microsoft Excel Discussion 7 7th Jun 2006 11:17 PM
Assign cell value to variable =?Utf-8?B?Um9va2llX1VzZXI=?= Microsoft Excel Programming 2 7th Jun 2006 08:15 PM
Change cell formula & assign to VBA variable... Kevin Lyons Microsoft Excel Programming 0 5th Feb 2005 06:58 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 06:55 PM.