View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Norman Jones Norman Jones is offline
external usenet poster
 
Posts: 5,302
Default Can anyone see the problem with this code?

Hi Cody,

This is odd. Rather than TextBox1 being visible under the true condition
is
is invisible and visible when C62 < 3

Help again please.


This is exactly as stipulated by your original code:

If Sheets("Sheet1").Range("C62") = 3 Then
TextBox1.Visible = False
Else: TextBox1.Visible = True
End If



However, try reversing the True and False values:

Sub DropDown1_Change()
With ActiveSheet.OLEObjects("TextBox1")
If Sheets("Sheet1").Range("C62") = 3 Then
.Visible = True
Else
.Visible = False
End If
End With
End Sub

---
Regards,
Norman



"Cody" wrote in message
...
This is odd. Rather than TextBox1 being visible under the true condition
is
is invisible and visible when C62 < 3

Help again please.



"Norman Jones" wrote:

Or, keeping to your range references:

Sub DropDown1_Change()
With ActiveSheet.OLEObjects("TextBox1")
If Sheets("Sheet1").Range("C62") = 3 Then
.Visible = False
Else
.Visible = True
End If
End With
End Sub


---
Regards,
Norman



"Cody" wrote in message
...
Sub DropDown1_Change()
If Sheets("Sheet1").Range("C62") = 3 Then
TextBox1.Visible = False
Else: TextBox1.Visible = True
End If
End Sub

The debugger say "Object Required" and highlights the Else line.

Thanks