create blank rows
Hi,
The following code looks at last used cell in column A then insert 25 rows
from that point. The Insert should carry thew format of the last row over.
Sub test()
Dim InsertionPoint As Range, rg As Range
Dim colToCheck As String
Dim expandBy As Long
Dim wsh As Worksheet
'---- CHANGE HERE -------
Set wsh = ActiveSheet
colToCheck = "A"
expandBy = 25
'------------------------
'Find last currently used row in column colToCheck
Set InsertionPoint = wsh.Range(colToCheck & 65536).End(xlUp).Offset(1,
0).EntireRow
'Insert rows
Set rg = InsertionPoint.Resize(expandBy)
rg.Insert
--
Regards,
Sébastien
<http://www.ondemandanalysis.com
"Coal Miner" wrote:
Column 'B' on my worksheet is labeled 'Work Order'. Each row, therefore,
will contain data related to that 'Work Order' #. I would like to create a
macro which will allow the user to hit a button which will add 25 rows to the
worksheet. The rows will be blank other than I would like it to assign the
next consecutive work order # (i.e. if we say we have 100 work orders
assigned, I would like to add 25 rows with work order #'s 101-125). It would
be nice if this code would also somehow copy the formatting of the row. Any
ideas out there??
|