I am trying to set a variable print range for retrieved data in which some of the cells may be blank. The range could be from one row up to 250 rows depending on the data retrieved. Columns A & B will not have any blank cells, but columns beyond C & D may have blank cells. As in the workbox below, I would need to set a print range of A1 to D17. I have a formula that will find the last row in column B, but I can't figure out how to set the range for two more columns to the right.
Range("A1", Range("B1").End(xlDown)).PrintOut
How do I set the print range to encompass columns C & D?
Range("A1", Range("B1").End(xlDown)).PrintOut
How do I set the print range to encompass columns C & D?
Print template.xlsx | ||||||
---|---|---|---|---|---|---|
A | B | C | D | |||
1 | Sold By: Me | |||||
2 | ||||||
3 | Name | Business Name | Phone # | |||
4 | 1 | John | 555-1234 | |||
5 | 2 | James | ||||
6 | 3 | Paul | P&S Cattle Co. | 555-1236 | ||
7 | 4 | Henry | 555-1237 | |||
8 | 5 | George | ||||
9 | 6 | Susan | Anytown Auto Parts | 555-1239 | ||
10 | 7 | Ginny | 555-1240 | |||
11 | 8 | Edith | Edith's Closet | 555-1241 | ||
12 | 9 | Beatrice | 555-1242 | |||
13 | 10 | Eric | ||||
14 | 11 | Joe | 555-1244 | |||
15 | 12 | Shawn | Shawn's Landscaping | 555-1245 | ||
16 | 13 | Steven | ||||
17 | 14 | Bobby | ||||
Sheet1 |