Try the following code. It works in two ways. You can select any
number of worksheets (hold down the CTRL key and click the worksheet
tabs) and the code will do the fill operation on the selected sheets.
Or, you can code the worksheet names directly in the code.
Sub AAA()
Dim FirstLine As Long
Dim N As Long
Dim LastLine As Long
Dim DataColumn As String
Dim WS As Variant
Dim WSS() As Worksheet
With ActiveWindow.SelectedSheets
If .Count > 1 Then
ReDim WSS(1 To .Count)
For N = 1 To .Count
Set WSS(N) = .Item(N)
Next N
Else
ReDim WSS(1 To 4)
Set WSS(1) = Worksheets("Sheet1") '<<< CHANGE AS REQUIRED
Set WSS(2) = Worksheets("Sheet2") '<<< CHANGE AS REQUIRED
Set WSS(3) = Worksheets("Sheet3") '<<< CHANGE AS REQUIRED
Set WSS(4) = Worksheets("Sheet4") '<<< CHANGE AS REQUIRED
End If
For Each WS In WSS
FirstLine = 1 '<<< CHANGE AS REQUIRED
DataColumn = "B" '<<< CHANGE AS REQUIRED
With WS
LastLine = .Cells(.Rows.Count, DataColumn).End(xlUp).Row
For N = FirstLine To LastLine
If .Cells(N, DataColumn).Value = vbNullString Then
.Cells(N, DataColumn).Value = _
.Cells(N - 1, DataColumn)
End If
Next N
End With
Next WS
End With
End Sub
Cordially,
Chip Pearson
Microsoft Most Valuable Professional
Excel Product Group, 1998 - 2009
Pearson Software Consulting, LLC
www.cpearson.com
(email on web site)