concatenation

  • Thread starter evelin via OfficeKB.com
  • Start date
E

evelin via OfficeKB.com

hi friends
i want to concatenate the value in cell A1 AND A2 AND PUT IN A1.
SUPPOSE " string1" is a string variable
EG. SUPPOSE A1 contains "office" and A2 contains "KB" , THEN variable
string1=OfficeKB
and assign to A1.

THIS MUST BE DONE FOR A SET OV VALUES
 
S

Stefi

What are the other set of values? A3-A4, A5-A7,... or B1-B2, C1-C2,... or
what? You'll need a VBA sub.
Stefi


„evelin via OfficeKB.com†ezt írta:
 
J

John Bundy

You say it needs to be done for a set of values, but don't really give
details, this may help more.
The first number after cells is the row, the second is the column

Sheet1.Cells(1, 1) = Sheet1.Cells(1, 1) & Sheet1.Cells(2, 1)

if you wanted to do this for column A, B, C on row one you would do this:

For i = 1 To 4
Sheet1.Cells(1, i) = Sheet1.Cells(1, i) & Sheet1.Cells(2, i)
Next
 
V

vavasoo

Sub ConcatenatingAdjacentCells()

Dim ToBeInserted As String, Length As Integer, Rows As Integer

For Rows = 1 To 1
Length = Len(Cells(Rows, 1))
ToBeInserted = Cells(Rows, 2)
Cells(Rows, 1).Characters(Length, 1).Insert (ToBeInserted)
Next

End Sub
 
Top