Hello All,
I have a worksheet containig 12 different charts. I have created a print button that brings up a user form that contains a check box for each chart name. Depending on which charts the user wants, they are to check the box next to each desired chart.
I am needing a print macro that will print the charts that were checked all on one page. It is very important that it is all on one page. I already have a macro that prints them on individual pages, but I am really needing them all on one.
Here is the code I have so far for the print button on my user form:
I have a worksheet containig 12 different charts. I have created a print button that brings up a user form that contains a check box for each chart name. Depending on which charts the user wants, they are to check the box next to each desired chart.
I am needing a print macro that will print the charts that were checked all on one page. It is very important that it is all on one page. I already have a macro that prints them on individual pages, but I am really needing them all on one.
Here is the code I have so far for the print button on my user form:
Any help is greatly appreciated!Private Sub CommandButton1_Click()
If Chart1.Value = True Then
ActiveSheet.ChartObjects("Chart 4").Activate
PaperSize = xlPaperLetter
ExecuteExcel4Macro "PRINT(1,,,1,,,,,,,,2,,,TRUE,,FALSE)"
ActiveWindow.ScrollRow = 32
ActiveWindow.ScrollRow = 34
ActiveWindow.ScrollRow = 36
ActiveWindow.ScrollRow = 38
ActiveWindow.ScrollRow = 40
ActiveWindow.ScrollRow = 42
ActiveWindow.ScrollRow = 44
ActiveWindow.ScrollRow = 46
ActiveWindow.ScrollRow = 48
ActiveWindow.ScrollRow = 50
ActiveWindow.ScrollRow = 52
ActiveWindow.ScrollRow = 54
ActiveWindow.ScrollRow = 56
ActiveWindow.ScrollRow = 58
ActiveWindow.ScrollRow = 60
ActiveWindow.ScrollRow = 62
End If
If Chart2.Value = True Then
ActiveSheet.ChartObjects("Chart 6").Activate
PaperSize = xlPaperLetter
ExecuteExcel4Macro "PRINT(1,,,1,,,,,,,,2,,,TRUE,,FALSE)"
ActiveWindow.ScrollRow = 68
ActiveWindow.ScrollRow = 70
ActiveWindow.ScrollRow = 72
ActiveWindow.ScrollRow = 74
ActiveWindow.ScrollRow = 76
ActiveWindow.ScrollRow = 78
ActiveWindow.ScrollRow = 80
ActiveWindow.ScrollRow = 82
ActiveWindow.ScrollRow = 84
ActiveWindow.ScrollRow = 86
ActiveWindow.ScrollRow = 88
ActiveWindow.ScrollRow = 90
ActiveWindow.ScrollRow = 92
ActiveWindow.ScrollRow = 94
ActiveWindow.ScrollRow = 96
ActiveWindow.ScrollRow = 98
End If
If Chart3.Value = True Then
ActiveSheet.ChartObjects("Chart 7").Activate
PaperSize = xlPaperLetter
ExecuteExcel4Macro "PRINT(1,,,1,,,,,,,,2,,,TRUE,,FALSE)"
ActiveWindow.ScrollRow = 104
ActiveWindow.ScrollRow = 106
ActiveWindow.ScrollRow = 108
ActiveWindow.ScrollRow = 110
ActiveWindow.ScrollRow = 112
ActiveWindow.ScrollRow = 114
ActiveWindow.ScrollRow = 116
ActiveWindow.ScrollRow = 118
ActiveWindow.ScrollRow = 120
ActiveWindow.ScrollRow = 122
ActiveWindow.ScrollRow = 124
ActiveWindow.ScrollRow = 126
ActiveWindow.ScrollRow = 128
ActiveWindow.ScrollRow = 130
ActiveWindow.ScrollRow = 132
ActiveWindow.ScrollRow = 134
End If
If Chart4.Value = True Then
ActiveSheet.ChartObjects("Chart 8").Activate
PaperSize = xlPaperLetter
ExecuteExcel4Macro "PRINT(1,,,1,,,,,,,,2,,,TRUE,,FALSE)"
ActiveWindow.ScrollRow = 138
ActiveWindow.ScrollRow = 140
ActiveWindow.ScrollRow = 142
ActiveWindow.ScrollRow = 144
ActiveWindow.ScrollRow = 146
ActiveWindow.ScrollRow = 148
ActiveWindow.ScrollRow = 150
ActiveWindow.ScrollRow = 152
ActiveWindow.ScrollRow = 154
ActiveWindow.ScrollRow = 156
ActiveWindow.ScrollRow = 158
ActiveWindow.ScrollRow = 160
ActiveWindow.ScrollRow = 162
ActiveWindow.ScrollRow = 164
ActiveWindow.ScrollRow = 166
ActiveWindow.ScrollRow = 168
End If
If Chart5.Value = True Then
ActiveSheet.ChartObjects("Chart 10").Activate
PaperSize = xlPaperLetter
ExecuteExcel4Macro "PRINT(1,,,1,,,,,,,,2,,,TRUE,,FALSE)"
ActiveWindow.ScrollRow = 174
ActiveWindow.ScrollRow = 176
ActiveWindow.ScrollRow = 178
ActiveWindow.ScrollRow = 180
ActiveWindow.ScrollRow = 182
ActiveWindow.ScrollRow = 184
ActiveWindow.ScrollRow = 186
ActiveWindow.ScrollRow = 188
ActiveWindow.ScrollRow = 190
ActiveWindow.ScrollRow = 192
ActiveWindow.ScrollRow = 194
ActiveWindow.ScrollRow = 196
ActiveWindow.ScrollRow = 198
ActiveWindow.ScrollRow = 200
ActiveWindow.ScrollRow = 202
ActiveWindow.ScrollRow = 204
End If
If Chart6.Value = True Then
ActiveSheet.ChartObjects("Chart 14").Activate
PaperSize = xlPaperLetter
ExecuteExcel4Macro "PRINT(1,,,1,,,,,,,,2,,,TRUE,,FALSE)"
ActiveWindow.ScrollRow = 208
ActiveWindow.ScrollRow = 210
ActiveWindow.ScrollRow = 212
ActiveWindow.ScrollRow = 214
ActiveWindow.ScrollRow = 216
ActiveWindow.ScrollRow = 218
ActiveWindow.ScrollRow = 220
ActiveWindow.ScrollRow = 222
ActiveWindow.ScrollRow = 224
ActiveWindow.ScrollRow = 226
ActiveWindow.ScrollRow = 228
ActiveWindow.ScrollRow = 230
ActiveWindow.ScrollRow = 232
ActiveWindow.ScrollRow = 234
ActiveWindow.ScrollRow = 236
ActiveWindow.ScrollRow = 238
End If
If Chart7.Value = True Then
ActiveSheet.ChartObjects("Chart 15").Activate
PaperSize = xlPaperLetter
ExecuteExcel4Macro "PRINT(1,,,1,,,,,,,,2,,,TRUE,,FALSE)"
ActiveWindow.ScrollRow = 246
ActiveWindow.ScrollRow = 248
ActiveWindow.ScrollRow = 250
ActiveWindow.ScrollRow = 252
ActiveWindow.ScrollRow = 254
ActiveWindow.ScrollRow = 256
ActiveWindow.ScrollRow = 258
ActiveWindow.ScrollRow = 260
ActiveWindow.ScrollRow = 262
ActiveWindow.ScrollRow = 264
ActiveWindow.ScrollRow = 266
ActiveWindow.ScrollRow = 268
ActiveWindow.ScrollRow = 270
ActiveWindow.ScrollRow = 272
ActiveWindow.ScrollRow = 274
ActiveWindow.ScrollRow = 276
End If
If Chart8.Value = True Then
ActiveSheet.ChartObjects("Chart 13").Activate
PaperSize = xlPaperLetter
ExecuteExcel4Macro "PRINT(1,,,1,,,,,,,,2,,,TRUE,,FALSE)"
ActiveWindow.ScrollRow = 284
ActiveWindow.ScrollRow = 286
ActiveWindow.ScrollRow = 288
ActiveWindow.ScrollRow = 290
ActiveWindow.ScrollRow = 292
ActiveWindow.ScrollRow = 294
ActiveWindow.ScrollRow = 296
ActiveWindow.ScrollRow = 298
ActiveWindow.ScrollRow = 300
ActiveWindow.ScrollRow = 302
ActiveWindow.ScrollRow = 304
ActiveWindow.ScrollRow = 306
ActiveWindow.ScrollRow = 308
ActiveWindow.ScrollRow = 310
ActiveWindow.ScrollRow = 312
ActiveWindow.ScrollRow = 314
End If
If Chart9.Value = True Then
ActiveSheet.ChartObjects("Chart 11").Activate
PaperSize = xlPaperLetter
ExecuteExcel4Macro "PRINT(1,,,1,,,,,,,,2,,,TRUE,,FALSE)"
ActiveWindow.ScrollRow = 320
ActiveWindow.ScrollRow = 322
ActiveWindow.ScrollRow = 324
ActiveWindow.ScrollRow = 326
ActiveWindow.ScrollRow = 328
ActiveWindow.ScrollRow = 330
ActiveWindow.ScrollRow = 332
ActiveWindow.ScrollRow = 334
ActiveWindow.ScrollRow = 336
ActiveWindow.ScrollRow = 338
ActiveWindow.ScrollRow = 340
ActiveWindow.ScrollRow = 342
ActiveWindow.ScrollRow = 344
ActiveWindow.ScrollRow = 346
ActiveWindow.ScrollRow = 348
ActiveWindow.ScrollRow = 350
End If
If Chart10.Value = True Then
ActiveSheet.ChartObjects("Chart 12").Activate
PaperSize = xlPaperLetter
ExecuteExcel4Macro "PRINT(1,,,1,,,,,,,,2,,,TRUE,,FALSE)"
ActiveWindow.ScrollRow = 358
ActiveWindow.ScrollRow = 360
ActiveWindow.ScrollRow = 362
ActiveWindow.ScrollRow = 364
ActiveWindow.ScrollRow = 366
ActiveWindow.ScrollRow = 368
ActiveWindow.ScrollRow = 370
ActiveWindow.ScrollRow = 372
ActiveWindow.ScrollRow = 374
ActiveWindow.ScrollRow = 376
ActiveWindow.ScrollRow = 378
ActiveWindow.ScrollRow = 380
ActiveWindow.ScrollRow = 382
ActiveWindow.ScrollRow = 384
ActiveWindow.ScrollRow = 386
ActiveWindow.ScrollRow = 388
End If
If Chart11.Value = True Then
ActiveSheet.ChartObjects("Chart 17").Activate
PaperSize = xlPaperLetter
ExecuteExcel4Macro "PRINT(1,,,1,,,,,,,,2,,,TRUE,,FALSE)"
ActiveWindow.ScrollRow = 396
ActiveWindow.ScrollRow = 398
ActiveWindow.ScrollRow = 400
ActiveWindow.ScrollRow = 402
ActiveWindow.ScrollRow = 404
ActiveWindow.ScrollRow = 406
ActiveWindow.ScrollRow = 408
ActiveWindow.ScrollRow = 410
ActiveWindow.ScrollRow = 412
ActiveWindow.ScrollRow = 414
ActiveWindow.ScrollRow = 416
ActiveWindow.ScrollRow = 418
ActiveWindow.ScrollRow = 420
ActiveWindow.ScrollRow = 422
ActiveWindow.ScrollRow = 424
ActiveWindow.ScrollRow = 426
End If
Unload Me
End Sub