Find & replace up to certain row

srosk

Board Regular
Joined
Sep 17, 2018
Messages
132
Is there a way for this code to only look until the last populated row in column A vs the entire columns D:K. IE, the data stops on row 84, but the following populates ' N/A' all the way down D:K where a cell is blank.

Thanks in advance!


Code:
    Columns("D:K").Select    Selection.Replace What:="", Replacement:="       N/A", lookat:=xlWhole, _
        SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
        ReplaceFormat:=False
 
This will get rid of the problem of the extra rows
Code:
Sub srosk()
   With Range("D1", Range("A" & Rows.Count).End(xlUp).Offset(, 10))
      .SpecialCells(xlBlanks).Value = "       N/A"
   End With
End Sub
Are you sure that J6 is actually blank, in an empty cell put =ISBLANK(J6), what does it return?
 
Upvote 0

Excel Facts

Can you AutoAverage in Excel?
There is a drop-down next to the AutoSum symbol. Open the drop-down to choose AVERAGE, COUNT, MAX, or MIN
Soo, to answer your question, it appears blank but indeed.. it is not. Which explains why the results weren't working correctly.
 
Upvote 0
That would explain it, but glad to see you have something that works.
 
Upvote 0
Glad to help & thanks for the feedback
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,182
Members
453,021
Latest member
Mohamed Magdi Tawfiq Emam

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