1

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

1 Answer 1

6

How about

Rows(3).Replace " ", ""
Sign up to request clarification or add additional context in comments.

1 Comment

Trim specifically does not remove single spaces between words.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.