![]() |
Help on Excel VBA macro
Hello,
sorry for the previous unfinished post, but I slipped on the enter key. I am doing an Excel macro to concatenate the contents of several excel files. The structure of these Excel files are the same, so I am basically automating the "copy & paste" function. However, in the final consolidated file, I also need to concatenate the contents of 2 adjacent cells (let say cells Ai and Bi where i = line number). Do you know how can I create a VB macro to replicate the Excel function "contenate" ?? Thanks |
Help on Excel VBA macro
Result = Range("A2").Value & Range("B2").Value
or Result = Cells(i,1).Value & Cells(i,2).Value where i is the row# Bob Umlas Excel MVP "Thierry" wrote in message ... Hello, sorry for the previous unfinished post, but I slipped on the enter key. I am doing an Excel macro to concatenate the contents of several excel files. The structure of these Excel files are the same, so I am basically automating the "copy & paste" function. However, in the final consolidated file, I also need to concatenate the contents of 2 adjacent cells (let say cells Ai and Bi where i = line number). Do you know how can I create a VB macro to replicate the Excel function "contenate" ?? Thanks |
Help on Excel VBA macro
Use the '&' to concatenate.
Sheets("sheet1").Cells(i,3) = Sheets("sheet1").Cells(i,1) & Sheets("sheet1").Cells(i,2) this will concatenate Ai and Bi into Ci If you want to pad them with a space between use & " " & kpd -----Original Message----- Hello, sorry for the previous unfinished post, but I slipped on the enter key. I am doing an Excel macro to concatenate the contents of several excel files. The structure of these Excel files are the same, so I am basically automating the "copy & paste" function. However, in the final consolidated file, I also need to concatenate the contents of 2 adjacent cells (let say cells Ai and Bi where i = line number). Do you know how can I create a VB macro to replicate the Excel function "contenate" ?? Thanks . |
All times are GMT +1. The time now is 12:03 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com