View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
joel joel is offline
external usenet poster
 
Posts: 9,101
Default fill dowb using macro

Real simple. Done this a thousand times before.

Sub FixColumns()

RowCount = 1
Do While Range("A" & RowCount) < ""
If Range("A" & RowCount) < 0 Then
RefNo = Range("A" & RowCount)
End If
Range("B" & RowCount) = RefNo

RowCount = RowCount + 1
Loop

End Sub


"tom_mcd" wrote:

I have the following spreadsheet that shows the following coluns A and B.
Cloumn A has a ref number whci needs to be inptu into Column B, however in
Column A where there is a 0 in the column below the ref number above it has
to be input into column B until you come to a different ref number in cloumn
A. for eg below.

A1 B1
1234 1234
0 1234
5678 5678
0 5678
0 5678
7881 7881
8992 8992
0 8992
Does anyone know how to achieve this automatically. I can do it using the If
statement but these can be massive files and are for inexperienced users so
i want to be able for them to run this auromatically by way of Macro if
possible.
Thanks in anticipation once again