wisemank

Board Regular
Joined
Jun 21, 2010
Messages
129
Hi there,

I want to fill in the blank cells in between two designated text strings. I column L, I have either blank cells or the words "DNIS:ARC" or "DNIS".

I need the replace the only the blank cells between "DNIS:ARC" and "DNIS" with the word "ARC" all the way through the data set in column L.

much appreciated.
 

Excel Facts

Best way to learn Power Query?
Read M is for (Data) Monkey book by Ken Puls and Miguel Escobar. It is the complete guide to Power Query.
example: Column L (before) Column L (after)
1 DNIS:ARC DNIS:ARC
2 ARC (filled in)
3 ARC
4 ARC
5 DNIS: DNIS:
6
7
8
9
10 DNIS:ARC DNIS:ARC
11 ARC
12 ARC
13 ARC
14 DNIS: DNIS:
 
Last edited:
Upvote 0
try this

Code:
Sub do_it()

For r = 1 To Cells(Rows.Count, "L").End(xlUp).Row
If Cells(r, "L") = "DNIS:ARC" And Cells(r + 1, "L") = "" And Cells(r + 2, "L") = "DNIS" Then Cells(r + 1, "L") = "Arc"
Next r

End Sub

hth,
Ross
 
Upvote 0
Thanks again...

I want to replace all blank cells in between the words DNIS:ARC and DNIS with the word ARC.
 
Upvote 0
how about this?

Code:
Sub do_it()

For r = 1 To Cells(Rows.Count, "L").End(xlUp).Row

If Cells(r, "L") = "DNIS:ARC" Then x = "On"
If Cells(r, "L") = "DNIS" Then x = "Off"

If Cells(r + 1, "L") = "" And x = "On" Then Cells(r + 1, "L") = "ARC"
Next r

End Sub

Ross
 
Upvote 0
Ok... Now I get all the blanks filled with the word ARC (progress). I Only need to put "ARC" from DNIS:ARC to DNIS and the rest of the blanks can remain blank.
 
Upvote 0
oops: need a colon

If Cells(r, "L") = "DNIS" Then x = "Off"
to
If Cells(r, "L") = "DNIS:" Then x = "Off"
 
Upvote 0
Maybe this

Code:
Sub MM1()
Dim lr As Long
lr = Cells(Rows.Count, "L").End(xlUp).Row
Range("A1:A" & lr).SpecialCells(xlCellTypeBlanks).Value = "ARC"
End Sub
 
Upvote 0

Forum statistics

Threads
1,214,626
Messages
6,120,602
Members
448,974
Latest member
ChristineC

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