VBA Macro to auto populate value

blossomthe2nd

Active Member
Joined
Oct 11, 2010
Messages
450
Hi Guys,

Im looking for a macro that will select all blank cells within a range B2:DL123 and populate it with "W",

I am using Excel 2003, can anyone help as I have tried a few different things to no avail !!!

Thanks
A
 

Excel Facts

Can a formula spear through sheets?
Use =SUM(January:December!E7) to sum E7 on all of the sheets from January through December
Try

Code:
Sub test()
Range("B2:DL123").SpecialCells(xlCellTypeBlanks).Value = "W"
End Sub
 
Upvote 0
Hi A
try
Code:
Sub adW()
For Each cell In Range("B2:DL123")
    If cell.Value = "" Then cell.Value = "W"
Next cell
End Sub
 
Upvote 0
Sub adW()
For Each cell In Range("B2:DL123")
If cell.Value = "" Then cell.Value = "W"
Next cell
End Sub

Hi Michael,

We have used your script as there was loads of conditions such as

If cell.Value = "Y" Then cell.Value = "Yes"

Do you know if this script can be amended for colour ? so if the background colur is Grey .value="no"

Thanks
 
Upvote 0
For Each cell In Range("B2:DL123")
If cell.Interior.ColorIndex = 15 Then cell.Value = "Weekend"
Next cell

Got it thanks
 
Upvote 0

Forum statistics

Threads
1,224,591
Messages
6,179,768
Members
452,940
Latest member
rootytrip

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