Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Setting Print Area
Hi,
Is it possible to set/reset the print area according to a cell value? e.g.:- if A1 = 1 then set print area to B1:B10 if A1 = 2 then set print area to C1:C10 etc. TIA Mike |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Setting Print Area
Right click sheet tabview codeinsert this. Now when you change cell a1 the
column range will print automatically. After testing change printpreview to printout Private Sub Worksheet_Change(ByVal Target As Range) If Target.Address < "$A$1" Then Exit Sub Range(Cells(1, Target), Cells(10, Target)).PrintPreview End Sub -- Don Guillett Microsoft MVP Excel SalesAid Software "Mike" wrote in message ... Hi, Is it possible to set/reset the print area according to a cell value? e.g.:- if A1 = 1 then set print area to B1:B10 if A1 = 2 then set print area to C1:C10 etc. TIA Mike |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Setting Print Area
You could do this
Alt+f11 to open VB editor. Double click 'This workbook' and paste this in Private Sub Workbook_BeforePrint(Cancel As Boolean) If Sheets("Sheet1").Range("A1").Value = 1 Then ActiveSheet.PageSetup.PrintArea = "$B$1:$B$10" ElseIf Sheets("Sheet1").Range("A1").Value = 2 Then ActiveSheet.PageSetup.PrintArea = "$C$1:$C$10" Else Cancel = True End If End Sub Mike "Mike" wrote: Hi, Is it possible to set/reset the print area according to a cell value? e.g.:- if A1 = 1 then set print area to B1:B10 if A1 = 2 then set print area to C1:C10 etc. TIA Mike |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Setting The Print-Area ? | New Users to Excel | |||
Setting The Print Area | Excel Programming | |||
setting a print area | Excel Programming | |||
Setting Print Area | Excel Programming | |||
Setting print area | Excel Programming |