Trim "Blank" Cells

PARans

Board Regular
Joined
May 24, 2007
Messages
181
I have some blank cells in a worksheet where I would like to enter zeros. A simple find replace doesn't work since excel doesn't see them as blank. I have discovered that there are spaces in the cells so I am thinking a TRIM fuction would work but I don't know how to apply it to a specific range.

Range(Cells(2, 6), Cells(lastrow, 6)).Select

How would I find cells in a specific range that appear to be blank and then replace each with 0?

Thanks!
 

Excel Facts

Why are there 1,048,576 rows in Excel?
The Excel team increased the size of the grid in 2007. There are 2^20 rows and 2^14 columns for a total of 17 billion cells.
Do they contain a single space only? If so:

Invoke Find & Replace (control+H)
Find: _ (where _ is a space character)
Replace: 0

In options check 'Match entire cell contents'

Hit Replace All
 
Upvote 0
Thank you all!

Peter, I used the Remove all Spaces example and then replaced all "" with "0". Spot on! Thanks!
 
Upvote 0

Forum statistics

Threads
1,224,522
Messages
6,179,297
Members
452,903
Latest member
Knuddeluff

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