Re: VBA and "If"?!
- From: Jim Thomlinson <James_Thomlinson@xxxxxxxxxxxxxxxxxxxxxx>
- Date: Fri, 10 Aug 2007 10:54:03 -0700
So Zone5, Zone4 and ... are only named ranges. In that case you can not just
reference them as if they were variables. Give this a try...
If Range("Zone5").Value = 0 Then
Range("Zone5").EntireRow.Hidden = True
End If
If Range("Zone4").Value = 0 Then
Range("Zone4").EntireRow.Hidden = True
End If
If Range("Zone3").Value = 0 Then
Range("Zone3").EntireRow.Hidden = True
End If
If Range("Zone2").Value = 0 Then
Range("Zone2").EntireRow.Hidden = True
End If
--
HTH...
Jim Thomlinson
"Jo" wrote:
On Aug 10, 12:48 pm, Jim Thomlinson <James_Thomlin...@owfg-Re-Move-.
This-.com> wrote:
I can see that you have a named range called Zone4 but it also appears that
you have a variable called Zone4. Where is your variable Zone4 declared and
how is the value initialized? I guess what I am saying is post the rest of
your code...
--
HTH...
Jim Thomlinson
"Jo" wrote:
I have this code runs fine but, for Zone4=7, its row gets hidden
although it shouldn't according to the code below. What could I be
missing?
If Zone5 = 0 Then
Range("Zone5").Select
Selection.EntireRow.Hidden = True
End If
If Zone4 = 0 Then
Range("Zone4").Select
Selection.EntireRow.Hidden = True
End If
If Zone3 = 0 Then
Range("Zone3").Select
Selection.EntireRow.Hidden = True
End If
If Zone2 = 0 Then
Range("Zone2").Select
Selection.EntireRow.Hidden = True
End If- Hide quoted text -
- Show quoted text -
Whole code is below:
Sub ZeroPointChangeA()
'
' ZeroPointChange Macro
' Macro recorded 8/2/2007 by Michael Sultan
'
'
Active***.ChartObjects("Chart 46").Activate
ActiveChart.Axes(xlValue).Select
With ActiveChart.Axes(xlValue)
.MinimumScale = Names("BaseCPM1").RefersToRange.Value
.MaximumScaleIsAuto = True
.MinorUnitIsAuto = True
.MajorUnitIsAuto = True
.Crosses = xlAutomatic
.ReversePlotOrder = False
.ScaleType = xlLinear
.DisplayUnit = xlNone
End With
ActiveChart.PlotArea.Select
ActiveChart.Axes(xlCategory).Select
With ActiveChart.Axes(xlCategory)
.MinimumScale = Names("BaseCR1").RefersToRange.Value * 100
.MaximumScaleIsAuto = True
.MinorUnitIsAuto = True
.MajorUnitIsAuto = True
.Crosses = xlAutomatic
.ReversePlotOrder = False
.ScaleType = xlLinear
.DisplayUnit = xlNone
End With
If Zone5 <= 0 Then
Range("Zone5").Select
Selection.EntireRow.Hidden = True
End If
If Zone4 <= 0 Then
Range("Zone4").Select
Selection.EntireRow.Hidden = True
End If
If Zone3 <= 0 Then
Range("Zone3").Select
Selection.EntireRow.Hidden = True
End If
If Zone2 <= 0 Then
Range("Zone2").Select
Selection.EntireRow.Hidden = True
End If
End Sub
- Follow-Ups:
- Re: VBA and "If"?!
- From: JMB
- Re: VBA and "If"?!
- References:
- VBA and "If"?!
- From: Jo
- Re: VBA and "If"?!
- From: Jo
- VBA and "If"?!
- Prev by Date: Re: Excel._Work***.SaveAs
- Next by Date: Re: Help! Can't find bug in program
- Previous by thread: Re: VBA and "If"?!
- Next by thread: Re: VBA and "If"?!
- Index(es):