fill for range, then use new value after blanks

Slowy

New Member
Joined
Aug 8, 2011
Messages
11
i have a phone log where A3 is the persons name
column B contains the data
at the end of the persons data in b, i have blanks
then starts a new persons phone records
number of calls vary per person
the persons name is only on the first line of the data that is in B

what i would like to is
Copy the persons name all the way down for every row in B that has data

i cannot figure out how to get the name to CHANGE once i hit a new name

thank you in advance
:banghead:
 

Excel Facts

Repeat Last Command
Pressing F4 adds dollar signs when editing a formula. When not editing, F4 repeats last command.
If I understand you correctly, I think this should work:
Code:
Sub MyInsertNames()
'   Copy down names into blank cells in column A and for all entries in column B (starting at row 3)
 
    Dim myLastRow As Long
    Dim i As Long
    Dim myName As String
    
    Application.ScreenUpdating = False
    
'   Find last row with data in column B
    myLastRow = Cells(Rows.Count, "B").End(xlUp).Row
    
'   Loop from row 3 to end populating blank data in column A
    For i = 3 To myLastRow
        If Len(Cells(i, "A")) > 0 Then
            myName = Cells(i, "A")
        Else
            If Len(Cells(i, "B")) > 0 Then Cells(i, "A") = myName
        End If
    Next i
    
    Application.ScreenUpdating = True
    
End Sub
 
Upvote 0

Forum statistics

Threads
1,224,527
Messages
6,179,351
Members
452,907
Latest member
Roland Deschain

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top