Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default Set variable equal to a cell value & more

I have a three part question.
First, I want to be able to assign a value in a cell, on
only one of three worksheets, to a variable.
Second, I want to be able to compare that value using a
CASE statement.
Finally, I want to be able to associate this macro to a
command button that will run it.
Thanks in advance,
Al
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Set variable equal to a cell value & more

Private Sub CommandButton1_Click
vVal = Worksheets("Sheet1").Range("B9").Value

Select Case vVal
Case 1

Case 2

Case Else
End Select
End Sub


Not sure of the significance of 1 of 3 worksheets.

Place a commandbutton on your sheet. Double click on it while in design
mode and you should get the declaration

Private Sub CommandButton1_Click

End Sub

You can add code in this procedure.

--
Regards,
Tom Ogilvy

"Al" wrote in message
...
I have a three part question.
First, I want to be able to assign a value in a cell, on
only one of three worksheets, to a variable.
Second, I want to be able to compare that value using a
CASE statement.
Finally, I want to be able to associate this macro to a
command button that will run it.
Thanks in advance,
Al



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
can I make cell "yes" equal 1, "no" equal 0 can I make cell yes equal 1, no equa Excel Discussion (Misc queries) 4 April 22nd 23 06:09 AM
VBA check to see if variable value is odd but not equal to 1 Dave L[_2_] Excel Discussion (Misc queries) 4 November 21st 07 01:54 AM
How to point to (select) a cell to the left from a cell where I enter the = equal sign? Dmitry Excel Discussion (Misc queries) 4 June 30th 06 06:49 AM
Addition to Turn cell red if today is greater or equal to date in cell Rich New Users to Excel 2 December 9th 04 02:06 AM
variable not equal to expression steve Excel Programming 2 August 11th 03 07:05 PM


All times are GMT +1. The time now is 02:09 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"