blank not empty

daveyc18

Well-known Member
Joined
Feb 11, 2013
Messages
709
Office Version
  1. 365
  2. 2010
so, i import a csv file into excel....the blank cells aren't actually empty

when i do len(a1) it shows "2." if i do "code(a1)" it shows 32. how do i make these cells truly blank?
 

Excel Facts

How to change case of text in Excel?
Use =UPPER() for upper case, =LOWER() for lower case, and =PROPER() for proper case. PROPER won't capitalize second c in Mccartney
Sounds like you have cells with whitespace in them,

Try going into the "blank" cells and deleting them, are there many cells like this?
 
Upvote 0
Sounds like you have cells with whitespace in them,

Try going into the "blank" cells and deleting them, are there many cells like this?


there's a bumch of cells like...im trying to look for a formula to clean it up and then copy and paste the same vlaue as values to make them blank....Or some sort of vba code to loop through the range and make them blank
 
Upvote 0
Coincidentally I made this yesterday

Code:
Sub TrimText()
Dim rng As Range
Dim cell As Range
Dim txt As String


Set rng = Selection
    For Each cell In rng
        txt = Application.Trim(cell.Value)
        cell.Value = txt
    Next cell
    
End Sub

Bear in mind it will take a very long time to run if you highlight an entire row, so be sure that your selection is sensible, hope this helps.
 
Upvote 0
How about
Code:
Sub daveveyc18()
   With Range("A1", Range("A" & Rows.count).End(xlUp))
      .Value = Evaluate("if({1},trim(clean(" & .Address & ")))")
   End With
End Sub
 
Upvote 0
How about
Code:
Sub daveveyc18()
   With Range("A1", Range("A" & Rows.count).End(xlUp))
      .Value = Evaluate("if({1},trim(clean(" & .Address & ")))")
   End With
End Sub

it worked! how does this work?

i've tried combining trim and clean via Excel, but it didnt seem to do the trick...how's this code different?
 
Upvote 0
It isn't, it's the same as putting =TRIM(CLEAN(A1)) in B1 & copying down.
 
Upvote 0

Forum statistics

Threads
1,215,353
Messages
6,124,463
Members
449,163
Latest member
kshealy

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