ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   printing Union of Ranges (https://www.excelbanter.com/excel-worksheet-functions/67510-printing-union-ranges.html)

anny

printing Union of Ranges
 
Hello

I can't figure out why this doesn't work. It gives a PrintPreview of my
whole table, A1:N27. What I want is a table with 6 adjacent columns A B C D
G H.

Dim Range1 As Range
Dim Range2 As Range
Dim RangeCombined As Range
Set Range1 = Range("$A$1:$D$27")
Set Range2 = Range("$G$1:$H$27")
Set RangeCombined = Union(Range1, Range2)

ActiveSheet.PageSetup.PrintArea = RangeCombined
ActiveSheet.PrintOut preview:=True

thks
anny



Gary''s Student

printing Union of Ranges
 
Hide cols E & F
--
Gary''s Student


"anny" wrote:

Hello

I can't figure out why this doesn't work. It gives a PrintPreview of my
whole table, A1:N27. What I want is a table with 6 adjacent columns A B C D
G H.

Dim Range1 As Range
Dim Range2 As Range
Dim RangeCombined As Range
Set Range1 = Range("$A$1:$D$27")
Set Range2 = Range("$G$1:$H$27")
Set RangeCombined = Union(Range1, Range2)

ActiveSheet.PageSetup.PrintArea = RangeCombined
ActiveSheet.PrintOut preview:=True

thks
anny




Gary''s Student

printing Union of Ranges
 
Also make the range contiguous.
--
Gary''s Student


"Gary''s Student" wrote:

Hide cols E & F
--
Gary''s Student


"anny" wrote:

Hello

I can't figure out why this doesn't work. It gives a PrintPreview of my
whole table, A1:N27. What I want is a table with 6 adjacent columns A B C D
G H.

Dim Range1 As Range
Dim Range2 As Range
Dim RangeCombined As Range
Set Range1 = Range("$A$1:$D$27")
Set Range2 = Range("$G$1:$H$27")
Set RangeCombined = Union(Range1, Range2)

ActiveSheet.PageSetup.PrintArea = RangeCombined
ActiveSheet.PrintOut preview:=True

thks
anny





All times are GMT +1. The time now is 07:08 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com