Deleting spaces from blank cell in sheet?

tonywatsonhelp

Well-known Member
Joined
Feb 24, 2014
Messages
3,210
Office Version
  1. 365
  2. 2019
  3. 2016
Platform
  1. Windows
Hi Everyone.
I need a macro that can help me clean up my data range.
We export data from our CRM system which is very old and the data needs sorting out before i can do anything with it.
I've done most of the macros but am stuck and looking for help.

I need a macro to help me empty out cells that are supposed to be blank.
Some of the blank cells have spaces or invisible data in them (what i mean is there no databut they don't register as "" when i do my formulas)
So what i'm hoping for is some way to have a macro make all cells that have a space but nothing else in them empty.
please help if you can.

Thanks
Tony
 

Excel Facts

Who is Mr Spreadsheet?
Author John Walkenbach was Mr Spreadsheet until his retirement in June 2019.
Code:
Option Explicit


Sub Clean()
Dim c As Range, rng As Range
Set rng = Range("A1:B10") 'Set your own range
For Each c In rng
c = Trim(c)
Next c
End Sub
 
Upvote 0
If you put this in an unused cell & point it to one of the "blank" cells, what does it say?
=CODE(a1)
 
Upvote 0
In that case try
Rich (BB code):
Sub tonywatson()
   ActiveSheet.UsedRange.Replace Chr(160), "", xlWhole, , , , False, False
End Sub
 
Upvote 0
You're welcome & thanks for the feedback
 
Upvote 0

Forum statistics

Threads
1,223,889
Messages
6,175,223
Members
452,620
Latest member
dsubash

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