Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Function =Trim() | Excel Worksheet Functions | |||
TRIM function | Excel Worksheet Functions | |||
Trim Function | Excel Discussion (Misc queries) | |||
Trim function in a macro | Excel Programming | |||
Need help with TRIM function | Excel Worksheet Functions |