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