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