![]() |
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 |
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 |
All times are GMT +1. The time now is 12:04 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com