Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Macro Calls
Hello, I am looking for some help in merging 4 columns together without losin information in any colum: i.e. If I have C A R S in 4 different columns, I want the fifth colum to say CARS. I did some research online and came across this tip: ____________________________________ Sub Connects() Dim intRow As Integer Dim txt As String intRow = 1 Do Until IsEmpty(Cells(intRow, 1)) Cells(intRow, 1) = Cells(intRow, 1) & " - " & Cells(intRow, 2) Cells(intRow, 2).ClearContents Range(Cells(intRow, 1), Cells(intRow, 2)).Merge intRow = intRow + 1 Loop Columns(1).AutoFit End Sub _____________________________________ I inserted this into a Macro, but I have no idea on how to call thi procedure. Can anyone please help??? Thanks ----------------------------------------------- ~~ Message posted from http://www.ExcelTip.com ~~View and post usenet messages directly from http://www.ExcelForum.com |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Macro Calls
Ichhat,
The macro seems to be an overkill for the task. The following would do the job: Say: C is in Column A Row 1 A is in Column B Row 1 R is in Column C Row 1 S is in column D Row 1 In column E type this formula =A1&B1&C1&D The ampersand & joins text together. Jamal the amph -----Original Message----- Hello, I am looking for some help in merging 4 columns together without losing information in any colum: i.e. If I have C A R S in 4 different columns, I want the fifth column to say CARS. I did some research online and came across this tip: ____________________________________ Sub Connects() Dim intRow As Integer Dim txt As String intRow = 1 Do Until IsEmpty(Cells(intRow, 1)) Cells(intRow, 1) = Cells(intRow, 1) & " - " & Cells (intRow, 2) Cells(intRow, 2).ClearContents Range(Cells(intRow, 1), Cells(intRow, 2)).Merge intRow = intRow + 1 Loop Columns(1).AutoFit End Sub _____________________________________ I inserted this into a Macro, but I have no idea on how to call this procedure. Can anyone please help??? Thanks. ------------------------------------------------ ~~ Message posted from http://www.ExcelTip.com/ ~~View and post usenet messages directly from http://www.ExcelForum.com/ . |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Macro Calls
hi
that's right that the macro is just a litle bigger for it. But if you want to use it, paste it under your own macro as a new one and in your macro just write connects ( because it is the name of the macro in your exemple) in a line to launch the macro you have found. When the connects macro will be done, the program will just restart on your own macro at the next line. |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Macro Calls
Jamal, Sorry, I gave a bad example: What I have is: Have a good day (Each word in a seperate cell) What I would like to do is: Have""a "" good""day in one cell. THE "" represent spaces. An idea how to get this ----------------------------------------------- ~~ Message posted from http://www.ExcelTip.com ~~View and post usenet messages directly from http://www.ExcelForum.com |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Macro Calls
Never Mind Jama, I figured it out...thank you! for those of you who didn't know, you can do: =(A1 &" " & B1 ----------------------------------------------- ~~ Message posted from http://www.ExcelTip.com ~~View and post usenet messages directly from http://www.ExcelForum.com |
#6
Posted to microsoft.public.excel.programming
|
|||
|
|||
Macro Calls
same 2 possibility
If you want to use the macro change " - " by " " in the line Cells(intRow, 1) = Cells(intRow, 1) & " - " & Cells(intRow, 2 if not, use the excel function =concatenate(A1," ",B1," ",C1," ",D1) in E1 for exempl |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Phone calls | Excel Discussion (Misc queries) | |||
Calls per Day | Excel Discussion (Misc queries) | |||
Attn: Dave P. Question re Pix Calls via Macro | Excel Discussion (Misc queries) | |||
"This macro calls that macro, which calls .."-how many? | Excel Programming | |||
VBA Calls | Excel Programming |