I've been searching this forum and have found just enough tidbits to get me on the road to frustration
Daily, I copy text (from another program) into Excel, remove some blanks, set the print area (the number of rows changes daily), copy this range into another sheet for sorting, then print both sheets.
I want to do all of this in a single vba macro. For "print_area", I tried setting a dynamic named range that 'refers to':
=OFFSET(Alpha!$C$4,0,0,MATCH("cg",Alpha!$C:$C)-0,5)
Then in my macro, I put the line:
ActiveSheet.PageSetup.PrintArea = "print_area"
When I run this, the following happens:
- the dynamic named range "print_area" becomes the actual values, replacing the formula I entered.
- "print_area" is always 12 rows shorter than the data.
My data is always 6 columns wide but the number of rows changes. Today, the numbers of rows is 278 but the "print_area" selection (using the method I described above) is 263 rows. I want the final print area to contain no blank rows since I copy this range and sort it on another sheet.
Any help is appreciated.
Thanks!!
Daily, I copy text (from another program) into Excel, remove some blanks, set the print area (the number of rows changes daily), copy this range into another sheet for sorting, then print both sheets.
I want to do all of this in a single vba macro. For "print_area", I tried setting a dynamic named range that 'refers to':
=OFFSET(Alpha!$C$4,0,0,MATCH("cg",Alpha!$C:$C)-0,5)
Then in my macro, I put the line:
ActiveSheet.PageSetup.PrintArea = "print_area"
When I run this, the following happens:
- the dynamic named range "print_area" becomes the actual values, replacing the formula I entered.
- "print_area" is always 12 rows shorter than the data.
My data is always 6 columns wide but the number of rows changes. Today, the numbers of rows is 278 but the "print_area" selection (using the method I described above) is 263 rows. I want the final print area to contain no blank rows since I copy this range and sort it on another sheet.
Any help is appreciated.
Thanks!!