Friday, 15 June 2012

How to concatenate text from a column into a new column? VBA Excel -


I am new to programming and I would like to work on a function to fix greetings in excel file.

To start, I would like to add dear " to a name in the first column, and I will put this value in the next column, so that I will end in the first column the name And the "Dear Name" in the next column.

The function that I have done so far is putting "dear" in the next column, but it does make someone correct my code Can I help me?

  Sub-LetterController () Dimming LetterExperience column range The limit sets in the form of saturation column = column (1) in letterSalutationColumn cell for each cell .facet (, 1). Value = "dear" and cell.text next end sub   

< Em> PS. I realize that I do not have to program this because it does not take long to do this already with the available tasks, but eventually I extend it to fix other data more complexity I want to - and just thought I can start with some simplicity.

Many thanks in advance!

The reason for this is that the cell is equal to the whole column, though you are close enough if you did ...

  letter.SalutationColumn.Cells for each cell   

.. It will cycle through each cell.

However, the way it is written, it will cycle through every cell in the entire column, which can crash excel or work at least slow.

Do whatever you are trying to do here. It works only with cells in cells A in column A:

  excel as sub-salutation () Set the worksheet dim LastRow as Excel.Range in the form of a long name range as Excel.Range = = LastRow with ActiveSheet ws = ("A" and .rows.Count). End (XLEEP) .ro set name line =. Range for each cell in the name range cell ("A2: A" and the last line). , 1) = "Dear" & amp; Cell. The next cell ending with the text sub   

also declares all the variables, which you want to achieve in the habit of doing this object < P> It uses the object statement to fully qualify.

Code> Reference, so instead of just referring to the column (1) or range (something) , you are specifying that it is < Code> ws , which is set to ActiveSheet .

No comments:

Post a Comment