If/Then help in returning value

  • Thread starter Thread starter Big Chris
  • Start date Start date
B

Big Chris

I've treked through the Excel Tips and search time and again through th
history on here but can't find anything that answers my query.....an
I'm pretty new to all this!

Please can anyone help?

I am basically trying to write a macro that says....

If Sheet2, CellA5 =1 then run box1.show
If Sheet2, CellA5 =2 then run box2.show
If Sheet3, CellA5 =3 then run box3.show

Trouble is Sheet2 is very hidden and protected so I can't go to th
cell and say 'If activecell' etc.....well I suppose I can but i
involves unhiding it and it contains the guts of my application. I
there any easy way?

Any ideas please?

Many thanks
 
one way:

If Worksheets("Sheet2").Range("A5").Value = 1 Then Box1.Show


Or

Select Case Worksheets("Sheet2").Range("A5").Value
Case 1
Box1.Show
Case 2
Box2.Show
Case 3
Box3.Show
Case Else
End Select
 
Chris,



--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
 
Try again,

If you avoid selecting, but address the range directly, the fact that the
sheet is hidden is immaterial. For instance,

With Worksheets("Sheet2").Range("A5")
If .Value = 1 Then
box1.show
ElseIf ... etc
End If
End With

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
 
Back
Top