help with repeating data from cell above

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
 
R

Ryan H

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top