print titles
Used this macro when I was at JP Morgan. Put your numbers in ColumnA and run
the macro:
Sub InsertAnyRows()
Dim insertNumber As Range
Dim insertStart As Range
Dim redRng As Range
Dim i As Integer
Set insertNumber = Application.InputBox _
(Prompt:="Select a point to begin inserting rows.
For instance, choose first non blank cell in Column A",
Title:="Add a row", Type:=8)
insertNumber.Select
If insertNumber <= 0 Then
MsgBox ("Invalid Number Entered")
Exit Sub
End If
Dim myRow As Long
lastcell = Cells(Rows.Count, "A").End(xlUp).Row
myRow = 1
Do Until myRow = lastcell
For i = 1 To Cells(myRow, 1)
If Cells(myRow, 1) < "" Then
Cells(myRow + 1, 1).Select
Selection.EntireRow.Insert Shift:=xlDown
End If
Next
lastcell = Cells(Rows.Count, "A").End(xlUp).Row
myRow = myRow + 1
Loop
End Sub
Remember to make a back of your Excel file, just in case the result
is...ummmm...unintended. It's a total PITA to try to recover lost data.
Regards,
Ryan---
--
RyGuy
"SteveDB1" wrote:
hello.
I have a page set up macro, and need to configure my print titles line of
activesheet.pagesetup
I see where I can insert the exact rows I want, but mine vary from file to
file, so I need to have a variant so that I can base the number of rows on
some variant criteria.
I was thinking that I could make this based on the rows being filled in with
a color, or no-fill.
The color is typically mid-grey-- color index # 15.
Thank you.
|