G
Guest
I am using a fantastic code provided by Ron de Bruin in this site. The code
bolds a row with the word "Total" and then inserts a blank row immediately
after that row.
In a single macro I have two worksheets where this is to be used. I am
having a problem in going to second sheet. The macro stops at "Dim Rng As
Range" at the second sheet. (I do not know VBA at all, not surprised?).
(the numbers are line numbers)
1 Application.Goto Reference:="PURCHASES"
2 Dim Rng As Range
3 Dim findstring As String
4 findstring+"Total"
5 Set Rng=Range("E:E").Find(What:=findstring,After:=Range("E" & Rows.Count),
6 LookAt:=xlPart)
7 While Not Rng Is Nothing
8 Rng.EntireRow.Cells.Font.Bold=True
9 Rng.Offset(1, 0).EntireRow.Insert
10 Set Rng=Range("E" & Rng.Row + 1 & "E:" & Rows.Count)_
11 .Find(What:=findstring, After:=Range("E" & Rows.Count), LookAr:=xlPart)
12 Wend
13 Application.Goto Reference:="SALES"
14 Dim Rng AS Range
15' to 24 Repeats lines 3 to 12.
Thank you
bolds a row with the word "Total" and then inserts a blank row immediately
after that row.
In a single macro I have two worksheets where this is to be used. I am
having a problem in going to second sheet. The macro stops at "Dim Rng As
Range" at the second sheet. (I do not know VBA at all, not surprised?).
(the numbers are line numbers)
1 Application.Goto Reference:="PURCHASES"
2 Dim Rng As Range
3 Dim findstring As String
4 findstring+"Total"
5 Set Rng=Range("E:E").Find(What:=findstring,After:=Range("E" & Rows.Count),
6 LookAt:=xlPart)
7 While Not Rng Is Nothing
8 Rng.EntireRow.Cells.Font.Bold=True
9 Rng.Offset(1, 0).EntireRow.Insert
10 Set Rng=Range("E" & Rng.Row + 1 & "E:" & Rows.Count)_
11 .Find(What:=findstring, After:=Range("E" & Rows.Count), LookAr:=xlPart)
12 Wend
13 Application.Goto Reference:="SALES"
14 Dim Rng AS Range
15' to 24 Repeats lines 3 to 12.
Thank you