AutoFill Row Numbers & Print Area
Hi sage -
1. Add these statements to your macro to number the rows:
Set homeCell = Range("B1") '<<change to top, left-most data cell
rowCnt = homeCell.CurrentRegion.Rows.Count
For i = 1 To rowCnt
homeCell.Offset(i - 1, -1) = i
Next i
2. Add this statement to set the print range:
ActiveSheet.PageSetup.PrintArea = homeCell.CurrentRegion.Address
---
Jay
"sage" wrote:
Hi, I'm a newbie with macros and need some help. I have a spreadsheet with
data extracted by a macro and I've inserted Column A which is blank. I need
to include something in the macro to auto fill the row numbers in column A to
the end of the data. The number of rows is changeable.
Also I need something that will set the print area each time the macro is
run but the print area changes each time as well. I don't need to actually
print the document though, just set the area ready to print.
|