LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 153
Default Trim function in macro

everyone. I saw a good, basic into to macros on the Microsoft site, and one
of the macros I found particularly useful was the one to concatanate two
columns into one. I got it to work nicely, until on some data, the new
concatanated column would have multiple spaces, probably because the data
came from a database field with fixed length. Anyhow, I tried to introduce
the Trim function in the macro, but it does not work. Can anyone help me to
eliminate multiple white spaces between the two values to be concatanated?
Below is the macro as I am trying to use it, and it works fine if you take
out the trims.

Sub Concatanate()

x = 2
Do While Cells(x, 1).Value < ""
Cells(x, 3).Value = Trim(Cells(x, 1)).Value + " " + Trim(Cells(x,
2)).Value
x = x + 1
Loop

End Sub




 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Function =Trim() Dowitch Excel Worksheet Functions 1 April 29th 09 06:49 PM
TRIM function Chimelle Excel Worksheet Functions 5 March 6th 08 09:45 PM
Trim Function Saxman[_2_] Excel Discussion (Misc queries) 7 August 2nd 07 01:20 AM
Trim function in a macro Domingos Junqueira Excel Programming 2 November 11th 05 06:43 AM
Need help with TRIM function Phil Excel Worksheet Functions 9 October 21st 05 08:02 PM


All times are GMT +1. The time now is 04:17 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"