View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
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