If a cell has specific text & another cell is empty then add value to that empty cell

ipbr21054

Well-known Member
Joined
Nov 16, 2010
Messages
5,756
Office Version
  1. 2007
Platform
  1. Windows
Morning,
I am looking for a code that will do the following.
Check for a specific value in a cell & on that same row check if another cell is empty or not.
If empty we need to write a value to that cell

So the text value to search for is DELIVERED NO SIG
It will be in column G
On the same row see if the cell at column L is empty or has a value.
If empty add a new text value to that cell NOW OPEN A CLAIM
If that cell has a value then exit sub.
Continue to search for another DELIVERED NO SIG.

The code best run from last row of values then up the page.

Many Thanks
 

Excel Facts

Excel Joke
Why can't spreadsheets drive cars? They crash too often!
Try this macro code.
VBA Code:
Sub Fill_L_column()
Dim Rng As Range
Dim T&, Lr&
Application.ScreenUpdating = False
Lr = Range("G" & Rows.Count).End(xlUp).Row
For T = Lr To 2 Step -1
If Range("G" & T) = "DELIVERED NO SIG" And Range("L" & T) = "" Then Range("L" & T) = "NOW OPEN A CLAIM"
Next T
Application.ScreenUpdating = True
End Sub
 
Upvote 0
Solution
Thanks for feed back. Try This faster code.
VBA Code:
Sub Fill_L_column()
Dim Rng As Range
Dim T&, Lr&
Application.ScreenUpdating = False
Lr = Range("G" & Rows.Count).End(xlUp).Row
For T = Lr To 2 Step -1
If Range("G" & T) = "DELIVERED NO SIG" And Range("L" & T) = "" Then S = S & ",L" & T
If Len(S) > 240 Or T = 2 Then Range(Mid(S, 2)) = "NOW OPEN A CLAIM"
Next T
Application.ScreenUpdating = True
End Sub
 
Upvote 0
Variable not defined when i try that ?

VBA Code:
Private Sub Worksheet_Activate()
    
        
Dim Rng As Range
Dim T&, Lr&
Application.ScreenUpdating = False
Lr = Range("G" & Rows.count).End(xlUp).Row
For T = Lr To 2 Step -1
If Range("G" & T) = "DELIVERED NO SIG" And Range("L" & T) = "" Then S = S & ",L" & T
If Len(S) > 240 Or T = 2 Then Range(Mid(S, 2)) = "NOW OPEN A CLAIM"
Next T
Application.ScreenUpdating = True

    
End Sub
 
Upvote 0
Try.
VBA Code:
Sub Fill_L_column()
Dim Rng As Range
Dim T&, Lr&, S$
Application.ScreenUpdating = False
Lr = Range("G" & Rows.Count).End(xlUp).Row
For T = Lr To 2 Step -1
If Range("G" & T) = "DELIVERED NO SIG" And Range("L" & T) = "" Then S = S & ",L" & T
If S <> "" Then
If Len(S) > 240 Or T = 2 Then Range(Mid(S, 2)) = "NOW OPEN A CLAIM": S = ""
End If
Next T
Application.ScreenUpdating = True
End Sub
 
Upvote 0

Forum statistics

Threads
1,223,993
Messages
6,175,845
Members
452,675
Latest member
duongtruc1610

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