CESBoston
CESBoston

Reputation: 83

Removing all spaces from a row of Excel using VBA

I am trying to remove all spaces (both beginning, end, middle, and anywhere else they may be) from each cell in row 3 of Excel. So far I have been able to successfully trim the rows, but that only removes a space at the end.

Could someone help me develop a VBA code that can remove all spaces from the entire row?

Here's what I have so far:

Sub Trim()
    [3:3] = [if(3:3<>"",trim(3:3),"")]
End Sub

Upvotes: 1

Views: 629

Answers (1)

SJR
SJR

Reputation: 23081

How about

Rows(3).Replace " ", ""

Upvotes: 6

Related Questions