How to paste the specific text in an entire column based on heading in VBA macro

Jarvis 0617

New Member
Joined
Jan 13, 2022
Messages
1
Office Version
  1. 2016
Platform
  1. Windows
  2. Web
Hello, in my excel workbook (Bulk_Upload.xlsm, Worksheets("Sheet1"), I have two columns (1st column header = Task type, 2nd column header = Active) when I run the macro, I want to automatically fill the some fixed Text in Task Type = SFLA & Active = TPR) in these two columns, and it has to fill the data until the beside column's last row range.
I'm new to macro, and I'd appreciate it if someone could assist me.

1642091808638.png
 

Excel Facts

What is the shortcut key for Format Selection?
Ctrl+1 (the number one) will open the Format dialog for whatever is selected.
VBA Code:
Sub test()
     With Sheets("sheet1")
          myrow = .Range("AD" & Rows.Count).End(xlUp).Row       'last row of Ad
          With .Range("AE2").Resize(myrow - 1, 2)               'this range of AE:AF
               .SpecialCells(xlBlanks).FormulaR1C1 = "=R[-1]C"  'put a formula in the blank cells
               .Value = .Value                                  'replace formulas with values
          End With
     End With
End Sub
 
Upvote 0

Forum statistics

Threads
1,214,918
Messages
6,122,246
Members
449,075
Latest member
staticfluids

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