Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 71
Default Can anyone see the problem with this code?

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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default Can anyone see the problem with this code?

Hi Cody,

Try:

Sub DropDown1_Change()
With ActiveSheet.OLEObjects("TextBox1")
If Sheets("Sheet1").Range("B1") = 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



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

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



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 71
Default Can anyone see the problem with this code?

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




  #5   Report Post  
Posted to microsoft.public.excel.programming
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








  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 71
Default Can anyone see the problem with this code?

Sorry I lost my mind. Everything works as it should.

Thanks again.



"Norman Jones" wrote:

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






Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Code problem Ruben Excel Discussion (Misc queries) 4 August 26th 08 08:22 AM
XLS to CSV Code Problem carl Excel Worksheet Functions 0 March 28th 07 01:21 AM
VBA Code Problem Shawn Excel Programming 9 July 19th 05 04:48 AM
Problem with the following code Vince Excel Programming 3 November 19th 04 08:51 AM
Code problem Rick[_11_] Excel Programming 1 August 8th 03 04:25 AM


All times are GMT +1. The time now is 07:44 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"