help with repeating data from cell above

  • Thread starter Thread starter Bobbo
  • Start date Start date
B

Bobbo

I have two colums, names in A and access level in B. I need to search through
A and if there is a empty cell then I need to copy the data from the cell
above. I will need to do this for however many rows there is data in Column B.

Thanks
Bob
 
I assume your Col.A range has a header, if not then adjust the code to fit
your application. Hope this helps! If so, let me know, click "YES" below.

Sub FindEmptyCells()

Dim rng As Range
Dim rngMyRange As Range
Dim lngLastRow As Long

' find last row in Col. B
lngLastRow = ActiveSheet.Cells(Rows.Count, "B").End(xlUp).Row

Set rngMyRange = ActiveSheet.Range("A2:A" & lngLastRow)

For Each rng In rngMyRange
If IsEmpty(rng) Then
rng.Value = rng.Offset(-1, 0).Value
End If
Next rng

End Sub
 
Back
Top