Need to macro to filter blanks and update text

Revathi

New Member
Joined
May 26, 2015
Messages
34
Hi all,

I need a macro with the following requirements.

1. I need to filter blanks in columns U and update those blanks as BRANCH.

2. I need to paste as blanks only for the used range in a column
:)
 

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.
For 1, try:
Code:
Sub ReplaceMe()
Dim x as Long
x = Cells(Rows.Count, 21).End(xlUp).Row
On Error Resume Next
Range("U1:U" & x).SpecialCells(xlCellTypeBlanks).Value = "BRANCH"
On Error Goto o
End Sub
Do not understand what you're asking for 2. What column? Is it a formula that returns "" or blank and you want to replace it with the value?

Reading your post but cannot see your spreadsheet, it's not clear.
 
Last edited:
Upvote 0
1. I need to filter blanks in columns U and update those blanks as BRANCH.
Try
Code:
Sub Fill_Blanks()
  On Error Resume Next
  Columns("U").SpecialCells(xlBlanks).Value = "BRANCH"
  On Error GoTo 0
End Sub

2. I need to paste as blanks only for the used range in a column
I don't know what this means. Can you spell it out in more detail?
 
Upvote 0
Hi Peter, with Columns("U"), does the code determine it's own last used row in that column i.e. row of last used cell? If so, was unaware, may try to use this more often, thanks.
 
Upvote 0
Hi Jack,

Thank you for the help. But i should take the used range based on Column A wherein i should filter only the blanks in column U and fill all the blanks as Branch until the line item used based on Column A. Please help.
 
Upvote 0
Hi Peter,

Thanks a lot. It works great.. but it is filling the data till the end of the page but i need to paste only as "Branch" based on the data used based on Column A.
 
Upvote 0
Hi Peter,

Thanks a lot. It works great.. but it is filling the data till the end of the page but i need to paste only as "Branch" based on the data used based on Column A.

Change this line
Code:
Columns("U").Resize(Range("A" & Rows.Count).End(xlUp).Row).SpecialCells(xlBlanks).Value = "BRANCH"
 
Upvote 0
Hi Peter, with Columns("U"), does the code determine it's own last used row in that column i.e. row of last used cell? If so, was unaware, may try to use this more often, thanks.
As indicated by the OP's comments, it goes to the end of the UsedRange
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,181
Members
453,022
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