View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
gocush[_28_] gocush[_28_] is offline
external usenet poster
 
Posts: 42
Default Automating Autofill Coding Question

Option Explicit

Sub FillColA()

Dim RowCount as Interger
Dim i As Integer
Dim NewValue

NewValue = Range("A1").Value

'Get the number of data rows
RowCount = Range("B65536").End(xlUp).Row

For i = 1 to RowCount

If Cells(i + 1, 1) = "" Then
Cells(i + 1, 1) = NewValue
Else
NewValue = Cells(i + 1, 1)
End If
Next i

End Sub

"TrishaB" wrote:

Using Excel 2000.

Situation: Importing a text file where column a contains part number,
columns b, c, and d contain information relating to column a. Column a's
value is only listed once for many values in columns b, c, and d.

Goal: Automate autofilling column a's value until that value changes. So,
if cell a1's first value is 12345 with 4 blank cells below it, we need to
autofill cells a2:a5 with 12345, then skip a6 and copy its value to the empty
cells beneath it until that value changes.

The number of cells vary between values.

Any help in accomplishing this would be greatly appreciated.

Trisha