Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default Trying to toggle visability of button

Where are you getting the value of the 'salestax' variable? Also,
it is bad programming practice to change the cell to which the
Target variable points.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"Jim at Eagle" wrote in
message
...
Trying to toggle visability of button based on value of named
range.
Private Sub Worksheet_SheetChange(ByVal Target As Range)
Target = sheet1.Range("d9")
ToggleButton1.Visible = True
Select Case salestax
Case 0.00001 To 100
ToggleButton1.Visible = True
Case Else
ToggleButton1.Visible = False
End Select
End Sub
Help Please
--
Jim at Eagle



  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default Trying to toggle visability of button

If 'salestax' is a named range, you need to use code like

Select Case Range("salestax").Value


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com




"Jim at Eagle" wrote in
message
...
salestax is a named cell
value is generated by if() and vlookup.
part of if() references cell D9 (unprotected override value for
salestax)
Trying to toggle visability of button based on change of cell
D9 or change
in salestax
Thanks

"Chip Pearson" wrote:

Where are you getting the value of the 'salestax' variable?
Also,
it is bad programming practice to change the cell to which the
Target variable points.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"Jim at Eagle" wrote in
message
...
Trying to toggle visability of button based on value of
named
range.
Private Sub Worksheet_SheetChange(ByVal Target As Range)
Target = sheet1.Range("d9")
ToggleButton1.Visible = True
Select Case salestax
Case 0.00001 To 100
ToggleButton1.Visible = True
Case Else
ToggleButton1.Visible = False
End Select
End Sub
Help Please
--
Jim at Eagle






  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Trying to toggle visability of button

There is no SheetChange event for a single worksheet. That event is in the
ThisWorkbook module and looks like this
Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)

End Sub

The individual worksheet change event, found by right clicking on the sheet
tab and selecting view code looks like this:

Private Sub Worksheet_Change(ByVal Target As Range)

End Sub



It is always best to select your events from the dropdown at the top of the
module.

then you know the event will work if events are enabled.

See Chip Pearson's page on events

http://www.cpearson.com/excel/events.htm

Also, to test which cell triggered the event it would be

Private Sub Worksheet_Change(ByVal Target As Range)
if Target.Address = "$D$4" then

end if
End Sub

or
if Target.Column = 1 then ' for the entire column as an example.



--
Regards,
Tom Ogilvy



"Jim at Eagle" wrote in message
...

Something is amiss
I tried just the following:

Private Sub Worksheet_SheetChange(ByVal Target As Range)
Target.Address = "D9"
ToggleButton1.Visible = False
End Sub

Nothing change on the unprotected woorsheet after changing the value of D9

"Jim at Eagle" wrote:

Tried this. Still no responce.

Private Sub Worksheet_SheetChange(ByVal Target As Range)
Target = sheet1.Range("D9")
Select Case Range("salestax").Value
Case 0.00001 To 100
ToggleButton1.Visible = True
Case Else
ToggleButton1.Visible = False
End Select
End Sub

Thanks for helping

"Chip Pearson" wrote:

If 'salestax' is a named range, you need to use code like

Select Case Range("salestax").Value


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com




"Jim at Eagle" wrote in
message
...
salestax is a named cell
value is generated by if() and vlookup.
part of if() references cell D9 (unprotected override value for
salestax)
Trying to toggle visability of button based on change of cell
D9 or change
in salestax
Thanks

"Chip Pearson" wrote:

Where are you getting the value of the 'salestax' variable?
Also,
it is bad programming practice to change the cell to which the
Target variable points.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"Jim at Eagle" wrote in
message
...
Trying to toggle visability of button based on value of
named
range.
Private Sub Worksheet_SheetChange(ByVal Target As Range)
Target = sheet1.Range("d9")
ToggleButton1.Visible = True
Select Case salestax
Case 0.00001 To 100
ToggleButton1.Visible = True
Case Else
ToggleButton1.Visible = False
End Select
End Sub
Help Please
--
Jim at Eagle








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
Toggle Button Squeaky Excel Worksheet Functions 0 September 17th 08 04:14 PM
Toggle Button NavEx Excel Worksheet Functions 1 May 23rd 06 02:40 AM
Toggle Button mick2 Excel Discussion (Misc queries) 5 November 27th 05 05:52 AM
Toggle button keithl816 Excel Discussion (Misc queries) 2 November 21st 05 09:16 PM
Toggle Button Ben E[_2_] Excel Programming 1 October 29th 03 04:42 PM


All times are GMT +1. The time now is 08:20 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"