A
Arvi Laanemets
Hi
I have a workbook designed in Excel2000, where visibility of some seets is
controlled by Change event of SetUp sheet. In Excel2000 it works OK, but
when I open the file in Excel2007 (it's first time I have used any version
of Excel higher than 2000 so long), then there are no errors returned by
VBA, but whenever the Visible property for seet is recalculated, the
property remains unchanged. And when a cell value on sheet is changed by
code, this value remains unchanged too. The code is here:
--------
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Column = 3 And (Target.Row = 2 Or Target.Row = 3) Then
If Sheets("SetUp").Range("MyMode") = "SingleLabel" Then
Sheets("SetUp").Range("MyFormat") = "A5"
End If
Sheets("Shipments").Visible = (Sheets("SetUp").Range("MyMode") =
"MultiLabel")
Sheets("MultiLabelA4").Visible = (Sheets("SetUp").Range("MyMode") =
"MultiLabel" And Sheets("SetUp").Range("MyFormat") = "A4")
Sheets("MultiLabelA5").Visible = (Sheets("SetUp").Range("MyMode") =
"MultiLabel" And Sheets("SetUp").Range("MyFormat") = "A5")
Sheets("SingleLabelA5").Visible = (Sheets("SetUp").Range("MyMode") =
"SingleLabel")
End If
End Sub
---------
P.e. I have SetUp!MyFormat="A4" and SetUp!MyMode="Multilabel". When I change
SetUp!MyMode="SingleLabel", in Excel2000 SetuUp!MyFormat is changed to "A5",
sheet SingleLabelA5 is made visible, and sheet Shipments and MultilabelA4
are made invisible. In Excel 2007 nothing happens. When i debug the code
step-by-step in Excel2007, I see, that p.e. the expression
(Sheets("SetUp").Range("MyMode") = "MultiLabel")
returns False, but Sheets("Shipments").Visible remains hidden, etc.
The macro security for Excel2007 is set to low at moment (it is medium for
Excel2000)
Thanks in advance for any help.
I have a workbook designed in Excel2000, where visibility of some seets is
controlled by Change event of SetUp sheet. In Excel2000 it works OK, but
when I open the file in Excel2007 (it's first time I have used any version
of Excel higher than 2000 so long), then there are no errors returned by
VBA, but whenever the Visible property for seet is recalculated, the
property remains unchanged. And when a cell value on sheet is changed by
code, this value remains unchanged too. The code is here:
--------
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Column = 3 And (Target.Row = 2 Or Target.Row = 3) Then
If Sheets("SetUp").Range("MyMode") = "SingleLabel" Then
Sheets("SetUp").Range("MyFormat") = "A5"
End If
Sheets("Shipments").Visible = (Sheets("SetUp").Range("MyMode") =
"MultiLabel")
Sheets("MultiLabelA4").Visible = (Sheets("SetUp").Range("MyMode") =
"MultiLabel" And Sheets("SetUp").Range("MyFormat") = "A4")
Sheets("MultiLabelA5").Visible = (Sheets("SetUp").Range("MyMode") =
"MultiLabel" And Sheets("SetUp").Range("MyFormat") = "A5")
Sheets("SingleLabelA5").Visible = (Sheets("SetUp").Range("MyMode") =
"SingleLabel")
End If
End Sub
---------
P.e. I have SetUp!MyFormat="A4" and SetUp!MyMode="Multilabel". When I change
SetUp!MyMode="SingleLabel", in Excel2000 SetuUp!MyFormat is changed to "A5",
sheet SingleLabelA5 is made visible, and sheet Shipments and MultilabelA4
are made invisible. In Excel 2007 nothing happens. When i debug the code
step-by-step in Excel2007, I see, that p.e. the expression
(Sheets("SetUp").Range("MyMode") = "MultiLabel")
returns False, but Sheets("Shipments").Visible remains hidden, etc.
The macro security for Excel2007 is set to low at moment (it is medium for
Excel2000)
Thanks in advance for any help.