PDA

View Full Version : [SOLVED:] dynamic chart layout



colene
04-28-2008, 06:31 AM
When cell b23 has x then the chart layout is to be landscape and for other values in portrait ..

colene
04-28-2008, 07:53 AM
If SourceSheet.Range("B23").Value = "x" Then
With Me.PageSetup
.ChartSize = xlFullPage
.Orientation = xlPortrait
.PaperSize = xlPaperA4
.FirstPageNumber = xlAutomatic
.Zoom = 100
End With
Else
With Me.PageSetup
.ChartSize = xlFullPage
.Orientation = xlLandscape
.PaperSize = xlPaperA4
.FirstPageNumber = xlAutomatic
.Zoom = 100
End With
End If



Is there a better way than this ...

lucas
04-28-2008, 08:52 AM
is sourcesheet a different sheet?

colene
04-28-2008, 10:43 AM
yes and i have the above code on charrt_activaTE

rory
04-28-2008, 02:27 PM
What do you mean by a "better" way?

david000
04-28-2008, 11:16 PM
Private Sub ToggleButton1_Click()
If Me.ToggleButton1 = True Then
Me.ToggleButton1.Caption = "Landscape Mode"
With ActiveSheet.PageSetup
.Orientation = xlLandscape
End With
Else
Me.ToggleButton1.Caption = "Portrait Mode"
With ActiveSheet.PageSetup
.Orientation = xlPortrait
End With
End If
End Sub