View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips[_6_] Bob Phillips[_6_] is offline
external usenet poster
 
Posts: 11,272
Default A macro to fill in the blank cells

Sub TidyUp()
Dim cLastRow As Long
Dim rng As Range
Dim i As Long
cLastRow = Cells(Rows.Count, "C").End(xlUp).Row
For i = 2 To cLastRow
If Cells(i, "A").Value = "" Then
Cells(i, "A").Value = Cells(i - 1, "A").Value
Cells(i, "B").Value = Cells(i - 1, "B").Value
End If
Next i

End Sub

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"jer101 " wrote in message
...
I recieve a file every month that requires me to it clean up before I
can us it in a pivot table. One of the things I am required to do is
copy data into blank cells, for example. In the following table I
would be requred to copy into row 2 and 3 what is on row 1 in columns A
and B. Then I would copy what's on row 4 column A and B onto line 5...
and so on. Is there a macro that would do this for me?

Spreadsheet column

A B C
1 Mr. Jones 9483 $3,434
2 $ 524
3 $3,200
4 Ms. Black 1052 $1,255
5 $ 251
6 Mr. Smith 2254 $ 553
7 Ms. James 5855 $ 651
8 $1,221
9 $9,332


---
Message posted from http://www.ExcelForum.com/