Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using Trim function in Excel

Status
Not open for further replies.

mjmacarty

MIS
Mar 29, 2003
8
US
I am trying to trim excess spaces off a range of cell values. I am using the following code with no luck:

Option Explicit
Dim i As Integer, j As Integer, Shit As String

Sub FixIt()
For j = 1 To 12
For i = 1 To 32

Shit = Cells(i, j).Value
Trim (Shit)
Next i
Next j
End Sub

Any help would be appreciated.
 
mj,

After you trimmed the local variable, you never "updated"
the Excel cell.

Wayne
 
Yes. Thanks, I figured it out. Actually, I was trying to update some numnbers that weren't behaving as numbers. Trim didn't do the trick. I used Val() instead. Thanks for the heads up.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top