You are here:

Excel/Copying a column value to a string variable



I would like to copy an entire column to a string variable. I know to copy one column to another column in Excel but not to a string variable. If StringBuilder needs to be used while copying, then what is the Reference we have to add to that macro to access StringBuilder.

Thanks for your answer

ANSWER: Hi Shrunga,

I'm not sure what you mean by "Copy an entire column to a string variable". Can you give me an example in an excel sheet - a source column, how you want to design the string in the destination column etc.


---------- FOLLOW-UP ----------

QUESTION: Thanks for your response.
Eg : I have a column called "Sentence"
In that I have the following values like below


I need the result to be assigned to a string variable.
String result = "I had my dinner"

Hi Shrunga,

I can suggest concatenate function or just the simple '&' function to handle this but I'm sure you have thought of it. Eg. B1 could have a formula =A1&A2&A3&A4.

In case there are more combinations possible in each column, then we might have to look at a macro to handle this.

Can you send me an excel containing all the possible combinations, input values and output values expected.

You can send me the file at Please mention the subject as AllExperts.

About Excel
This topic answers questions related to Microsoft Excel spreadsheet (or workbook) stand-alone or Mircrosoft Office Excel including Excel 2003, Excel 2007, Office 2000, and Office XP. You can get Excel help on Excel formulas(or functions), Excell macros, charting in Excel, advanced features, and the general use of Excel. This does not provide a general Excel tutorial nor the basics of using a spreadsheet. It provides specific answers to using Microsoft Excel only. If you do not see your Excel question answered in this area then please ask an Excel question here


All Answers

Answers by Expert:

Ask Experts




I can answer questions related to the following topics: 1. MS Excel - Creating and Linking Formulae, Running Pivot Tables, Vlookup etc. 2. Macros / VBA - Creating Macros to do specific jobs. Importing / Exporting / Validating Data in excel through Macros.


I've been working on excel for over 10 years and on VBA macros for over 3 years now.

Bachelor of Commerce, Chartered Accountant from The Institute of Chartered Accountants of India

©2016 All rights reserved.