Null values

RoseChapman

New Member
Joined
Jun 12, 2018
Messages
40
Hello,

I do not have values in all cells of my spreadsheet and I have to add "0", to those cells with nothing on it between D to CU columns. Is there a way to do this with MACROS? I would really appreciate your help

Many thanks
 

Excel Facts

Show numbers in thousands?
Use a custom number format of #,##0,K. Each comma after the final 0 will divide the displayed number by another thousand
If the cells are genuinely empty try
Code:
Sub RoseChapman()
   Range("D:CU").SpecialCells(xlBlanks).Value = 0
End Sub
 
Upvote 0
Thank you very much Moderator,
I have added the following, but it does not work, not sure why, could you please help?. Many thanks

Worksheets("sheet2").Range("D2:CU").SpecialCells(xlBlanks).Value = 0
 
Upvote 0
Many thanks for your help Fluff,

using your code, I have added the following, but it does not work, not sure why, could you please help? many thanks

Worksheets("sheet2").Range("D2:CU").SpecialCells(xlBlanks).Value = 0
 
Upvote 0
The code only works on the usedrange, so if it's putting 0s into all rows, you have some extraneous data or formatting somewhere in the row 1048576.
Select the rows below your data to the vary last row & delete them. Then save the file
You may also need to delete all the columns to the right of your data as well.
 
Upvote 0

Forum statistics

Threads
1,223,902
Messages
6,175,278
Members
452,629
Latest member
SahilPolekar

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