MACROS
Sub Test()
Dim iLastRow As Long
Dim i As Long
Dim rng As Range
Dim sTmp
iLastRow = Cells(Rows.Count, "A").End(xlUp).Row
For i = iLastRow To 1 Step -1
If Cells(i, "A").Value Like "*PRINTED*" Then
sTmp = Cells(i, "A").Value
If rng Is Nothing Then
Set rng = Rows(i)
Else
Set rng = Union(rng, Rows(i))
End If
ElseIf Cells(i, "A").Value Like "SUBTTL" Then
Cells(i, "B").Value = sTmp
sTmp = ""
End If
Next i
If Not rng Is Nothing Then rng.Delete
End Sub
--
HTH
Bob Phillips
(replace somewhere in email address with gmail if mailing direct)
"nazzoli" wrote in message
...
I am new to writing a Macro. Here is what I am looking to do:
I have a file that is approx 4000 lines long. Every 8 cells in a column I
have a new subtotal. And in between the 8 cells I have a cell that says 2
printed. What I would like to do is move the cell that says 2 printed up
next to the subtotal. Is it possible to say after every four cells in
column
A move to column.
HEre is an example of what I am looking to do:
A B
1 SUBTTL
2
3
4 2 PRINTED
5
6
7
8 SUBTTL
9
10
11
12 5 PRINTED
Move 2 printed to cell B1 and move 5 printed in cell a 12 to B8 and so on.
Thanks.
|