Delete Blanks from Formulas using Visual Basic

twolf

New Member
Joined
Dec 30, 2005
Messages
2
Hi,

I a novice. I am trying to use Visual Basic to delete blanks that are left when I use a formula. This is what I do:

1) Write an IF statement. If the answer is false, then I ask it to return "" (nothing).

2) I copy over the cells with the formula by pasting values.

3) The cells that had "" are still do not act blank. How do I remove all contents from those cells?

Thanks,
 

Excel Facts

Select all contiguous cells
Pressing Ctrl+* (asterisk) will select the "current region" - all contiguous cells in all directions.
Welcome to MrExcel!

Here's what I'd suggest (works for me):
Change the FALSE part of your IF statement to return something that wouldn't be returned for TRUE. For example, I use "zzz". Copy and paste your data. Then Find & Replace. Find "zzz" and leave the replace section blank.

Regards,
 
Upvote 0
Barrie,

Thank you very much for your reply. That is the same strategy I planned on using, but I thought that there might be an easier way using a macro. Either way, the "zzz" approach will work well enough for my needs.

Thanks again,
 
Upvote 0

Forum statistics

Threads
1,214,932
Messages
6,122,323
Members
449,077
Latest member
jmsotelo

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