VBA - Clear "cells that look blank but AREN'T actually blank"

ckp90c

New Member
Joined
Dec 22, 2016
Messages
11
Hi All - I have a macro coded below that looks in Column A and will essentially clear cells that look blank but aren't actually blanks. It does work, however it is very slow and I don't think I can make it client-facing in its current state. Is there a way to make it run faster and/or prettier? Thank you!




Sub ClearEmptyValues()


Application.ScreenUpdating = False


For Each cell In UsedRange.Columns("A").Cells
If Not IsEmpty(cell) And cell.Value = vbNullString Then cell.Formula = vbNullString
Next


End Sub
 

Excel Facts

Last used cell?
Press Ctrl+End to move to what Excel thinks is the last used cell.
If col A is the result of pasting formula using paste as value then try
Code:
Sub MakeEmpty()
With Intersect(ActiveSheet.UsedRange, Columns(1))
   .Value = .Value
End With
End Sub
 
Upvote 0
Hey actually I think I have it now...I put the code in a Module, vs the sheet itself and it seems fine now. Thank you!
 
Upvote 0
Glad it's sorted & thanks for the feedback
 
Last edited:
Upvote 0

Forum statistics

Threads
1,224,824
Messages
6,181,186
Members
453,020
Latest member
Mohamed Magdi Tawfiq Emam

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