If cell in column A is empty insert Text. Stop at row that has no values

BerndH

New Member
Joined
Nov 24, 2021
Messages
5
Office Version
  1. 365
Platform
  1. Windows
I am looking for VBA code doing this:

If cell in column A is empty insert Text. Stop at row that has no values

Here you can see that row ID 28 is the last column and no TEXT is added to the rows underneath 28


Untitled.png


So far I wrote this code but don't know hot to solve the problem

VBA Code:
Dim excelarea As Range
Dim excelcell As Range
Set excelarea = Worksheets("Table1").Range("A1:A100")
For Each excelcell In raBereich
    If excelarea = "" And excelcell.Offset(0, 1) <> "" Then
       [INSERT TEXT IN EACH EMPTY CELL IN THE COLUMN A "HERE MISSING"]
    End If
Next excelcell
End Sub
 

Excel Facts

Can Excel fill bagel flavors?
You can teach Excel a new custom list. Type the list in cells, File, Options, Advanced, Edit Custom Lists, Import, OK
Your "Before" and "After" look exactly the same.
 
Upvote 0
Your "Before" and "After" look exactly the same.

Sorry I messed it up. Here is the corrected screenshot :)
 

Attachments

  • Untitledc.png
    Untitledc.png
    26.9 KB · Views: 18
Upvote 0
See if this does what you want. Test with a copy of your data.

VBA Code:
Sub FillMissing()
  Dim lr As Long
  
  lr = Columns("A:B").Find(What:="*", LookIn:=xlValues, SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row
  On Error Resume Next
    Range("A1:A" & lr).SpecialCells(xlBlanks).Value = "HERE MISSING"
  On Error GoTo 0
End Sub
 
Upvote 0

Forum statistics

Threads
1,223,911
Messages
6,175,337
Members
452,637
Latest member
Ezio2866

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