Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Selecting a specific cell (that is data validated)
Okay, sorry, I'll try to explain my problem better. The following is my code currently. Code: -------------------- Private Sub Worksheet_Activate() ' ' Dim A As Variant Dim B As Variant Dim C As Variant Dim D As Variant ' Range("D8").Select A = ActiveCell.Value Range("C33").Select C = ActiveCell.Value ' Sheets("Revenue").Select Range("D8").Select B = ActiveCell.Value Range("C33").Select D = ActiveCell.Value ' ' If A < B Or C < D Then MsgBox "Please make sure that the currency choice and percentage of attendance are uniform for all sheets before viewing this page. Thank you." End If ' ' End Sub -------------------- The ranges selected are cells that when you click on them, they drop down a list of choices (data validation set to the list option), so I'm trying to get the code to read what exact value it's on at the moment, but when I step through the code, I get an error saying: Run-time error '1004': Application-defined or object-defined error. So I changed my variables to variant to cover everything, but still the problem. When I do the direct A = Range("D8"), A doesn't pick up anything and is set at "nothing" I hope this is clearer, Cami -- cliodne ------------------------------------------------------------------------ cliodne's Profile: http://www.excelforum.com/member.php...o&userid=28774 View this thread: http://www.excelforum.com/showthread...hreadid=534873 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Selecting a specific cell (that is data validated)
Private Sub Worksheet_Activate()
' If Range("D8").Value < Worksheets("Revenue").Range("D8").Value or _ Range("C33").Value < Worksheets("Revenue").Range("C33").Value _ Then MsgBox "Please make sure that the currency choice and percentage of attendance are uniform for all sheets before viewing this page. Thank you." End If ' ' End Sub -- Regards, Tom Ogilvy "cliodne" wrote in message ... Okay, sorry, I'll try to explain my problem better. The following is my code currently. Code: -------------------- Private Sub Worksheet_Activate() ' ' Dim A As Variant Dim B As Variant Dim C As Variant Dim D As Variant ' Range("D8").Select A = ActiveCell.Value Range("C33").Select C = ActiveCell.Value ' Sheets("Revenue").Select Range("D8").Select B = ActiveCell.Value Range("C33").Select D = ActiveCell.Value ' ' If A < B Or C < D Then MsgBox "Please make sure that the currency choice and percentage of attendance are uniform for all sheets before viewing this page. Thank you." End If ' ' End Sub -------------------- The ranges selected are cells that when you click on them, they drop down a list of choices (data validation set to the list option), so I'm trying to get the code to read what exact value it's on at the moment, but when I step through the code, I get an error saying: Run-time error '1004': Application-defined or object-defined error. So I changed my variables to variant to cover everything, but still the problem. When I do the direct A = Range("D8"), A doesn't pick up anything and is set at "nothing" I hope this is clearer, Cami -- cliodne ------------------------------------------------------------------------ cliodne's Profile: http://www.excelforum.com/member.php...o&userid=28774 View this thread: http://www.excelforum.com/showthread...hreadid=534873 |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Selecting a specific cell (that is data validated)
Thank you Tom. I must remember that format - works like a charm, Cami -- cliodne ------------------------------------------------------------------------ cliodne's Profile: http://www.excelforum.com/member.php...o&userid=28774 View this thread: http://www.excelforum.com/showthread...hreadid=534873 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Selecting data from a specific column | Excel Discussion (Misc queries) | |||
Data Validated Cell Arrow not Appearing | Excel Discussion (Misc queries) | |||
cell data not validated if navigating cell to cell with mouse | Excel Worksheet Functions | |||
Selecting Specific Data within a Table | Excel Worksheet Functions | |||
be validated or not validated in a cell | Excel Programming |