Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 17
Default disable multiple toggle buttons

Hi,

I'm trying to disable multiple toggle buttons (ToggleButton1 and
ToggleButton2). I am currently using this code for ToggleButton1:

Private Sub Worksheet_Change(ByVal Target As Range)

Dim Temp As Double
Temp = Range("J4") / Range("H4")
If Temp < 0.5 Then
ToggleButton1.Enabled = True
Else: ToggleButton1.Enabled = False
End If
End Sub

....and it works great.

But now, I have another toggle button on the same sheet and I want it to be
enabled only if cell L4 is greater than or equal to 300. I've searched the
site and tried everything I can think of, to no avail.

If it is possible to enable/disable multiple toggle buttons on the same
worksheet, please let me know how I should adjust my code or what additional
code I need to use to make it work.

Thank you.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 857
Default disable multiple toggle buttons

Hi,

Try it this way:

Private Sub Worksheet_Change(ByVal Target As Range)

Dim Temp As Double
If Target.Address = "$J$4" Or Target.Address = "$H$4" Then
Temp = Range("J4") / Range("H4")
togglebutton1.Enabled = Temp < 0.5
ElseIf Target.Address = "$L$4" Then
ToggleButton2.Enabled = Range("L4").Value = 300
End If

End Sub


--
Hope that helps.

Vergel Adriano


"Shoney" wrote:

Hi,

I'm trying to disable multiple toggle buttons (ToggleButton1 and
ToggleButton2). I am currently using this code for ToggleButton1:

Private Sub Worksheet_Change(ByVal Target As Range)

Dim Temp As Double
Temp = Range("J4") / Range("H4")
If Temp < 0.5 Then
ToggleButton1.Enabled = True
Else: ToggleButton1.Enabled = False
End If
End Sub

...and it works great.

But now, I have another toggle button on the same sheet and I want it to be
enabled only if cell L4 is greater than or equal to 300. I've searched the
site and tried everything I can think of, to no avail.

If it is possible to enable/disable multiple toggle buttons on the same
worksheet, please let me know how I should adjust my code or what additional
code I need to use to make it work.

Thank you.

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
enable/disable multiple buttons Shoney Excel Discussion (Misc queries) 1 January 11th 08 02:41 AM
Toggle buttons FloMM2 Excel Programming 3 August 7th 07 07:52 PM
have toggle buttons but everytime print preview buttons move TinSandhu Excel Discussion (Misc queries) 1 October 11th 06 02:57 PM
Toggle Buttons Momo Excel Programming 2 February 9th 05 01:35 PM
multiple toggle buttons Nelson Excel Programming 3 November 2nd 04 08:27 AM


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

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

About Us

"It's about Microsoft Excel"