Gary,
Worked like a charm! Thanks for your help (and patience).
Cheers,
Craig
On Tuesday, May 1, 2012 12:27:42 AM UTC-3, GS wrote:
TheMilkGuy brought next idea :
Gary,
Thanks for the quick reply. You were correct, they are forms checkboxes.
How would the code change if P1:P3 were on another worksheet?
Thanks,
Craig
The tests I did with code code had everything on Sheets("Sheet1"). I
commented the lines to edit to suit your model, and so all you need to
do is substitute your sheetname for "Sheet1" in the code. Obviously,
the range addresses also need to be edited to your linked cells. (Both
Case scenarios)
Also, the procedure can be revised as follows:
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = "$H$8" Then '//BETTER TO USE NAMED RANGE HERE
Select Case Target.Value
Case "A", "B"
With Sheets("Sheet1") '//edit to suit
.Range("P1:P2") = True: .Range("P3:P4") = False
End With
Case "C", "D"
With Sheets("Sheet1") '//edit to suit
.Range("P1:P2") = False: .Range("P3:P4") = True
End With
End Select
End With
End If
End Sub
Take note of my comment to name "$H$8" so you're not hard-coding its
address. This will make your code maintenance free if you add/remove
cols/rows that affect its location. After naming it revise the line of
code as follows...
If Target = Range(<MyName) Then
..where you substitute <MyName with a string value containing the
name you gave $H$8. I recommend using local scope for the name. To do
this via the NameBox left of the FormulaBar, wrap the sheetname of $H$8
in apostrophes followed by the exclamation character and the name.
Example
'Sheet Name'!MyName
--
Garry
Free usenet access at http://www.eternal-september.org
ClassicVB Users Regroup!
comp.lang.basic.visual.misc
microsoft.public.vb.general.discussion