Stop at first Empty Row/cell in Column B - Fill Data

ctild

New Member
Joined
Jan 26, 2008
Messages
44
I have a worksheet that includes a list of items in Column B, starting at Cell "B25". But the length of the list is not consistent. In Column S I have to fill in text against each item listed in Column B, but if no Data available I leave the corresponding cell in Column S Blank.
<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p></o:p>
What I'm looking for is:-
Until it hits the last entry in Column B, a code that will check for each entry in Column B, a blank cells exists in Column S. If it finds a blank cell in Column S, insert the default text of "Box 1".

<o:p></o:p>
Any help appreciated.<o:p></o:p>
 

Excel Facts

Copy a format multiple times
Select a formatted range. Double-click the Format Painter (left side of Home tab). You can paste formatting multiple times. Esc to stop
This macro should do that:
Code:
Sub MyAutoFillLoop()
 
    Dim myLastRow As Long
    Dim myRow As Long
    
    Application.ScreenUpdating = False
    
'   Find last row with data in column B
    myLastRow = Cells(Rows.Count, "B").End(xlUp).Row
    
'   Loop through rows 25 to last row in column B
    For myRow = 25 To myLastRow
'   Check for entries in column B and S and populate S, if necessary
        If Len(Cells(myRow, "B")) > 0 And Len(Cells(myRow, "S")) = 0 Then
            Cells(myRow, "S") = "Box 1"
        End If
    Next myRow
    
    Application.ScreenUpdating = True
    
End Sub
 
Upvote 0

Forum statistics

Threads
1,224,616
Messages
6,179,911
Members
452,949
Latest member
beartooth91

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