ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Concatenate Multiple Cells (https://www.excelbanter.com/excel-discussion-misc-queries/41284-concatenate-multiple-cells.html)

Sonya795

Concatenate Multiple Cells
 

Hello everyone.

I need your help.
I using FOR LOOP to loop through N-number of times in order to find
necessary data.
I have trouble placing this data in ONE cell:
Here is code that I use

For i = 1 To intRowCount

ActiveCell.FormulaR1C1 = "=R" & Range("F26").Value & "C3&""|"" "
Range("F26").Value = Range("F26").Value + 1


ActiveCell.Value = ActiveCell.Value + ActiveCell.Value ' +
ActiveCell.Offset(1, 0).Select
Next i

How to place programmatically found data into ONE cell
Thanks in advance,

Sonya


--
Sonya795
------------------------------------------------------------------------
Sonya795's Profile: http://www.excelforum.com/member.php...o&userid=26110
View this thread: http://www.excelforum.com/showthread...hreadid=397276


Bob Phillips

Not clear on what you are doing.

The first formula creates a formula such as =$C$7&"|"

You then try to add that to itself, which doesn't work as it has text. Do
you mean?

ActiveCell.Value = ActiveCell.Value & ActiveCell.Value


--

HTH

RP
(remove nothere from the email address if mailing direct)


"Sonya795" wrote in
message ...

Hello everyone.

I need your help.
I using FOR LOOP to loop through N-number of times in order to find
necessary data.
I have trouble placing this data in ONE cell:
Here is code that I use

For i = 1 To intRowCount

ActiveCell.FormulaR1C1 = "=R" & Range("F26").Value & "C3&""|"" "
Range("F26").Value = Range("F26").Value + 1


ActiveCell.Value = ActiveCell.Value + ActiveCell.Value ' +
ActiveCell.Offset(1, 0).Select
Next i

How to place programmatically found data into ONE cell
Thanks in advance,

Sonya


--
Sonya795
------------------------------------------------------------------------
Sonya795's Profile:

http://www.excelforum.com/member.php...o&userid=26110
View this thread: http://www.excelforum.com/showthread...hreadid=397276




Sonya795


Bob,

Here is the exact code that I am using:

For i = 1 To intRowCount

ActiveCell.FormulaR1C1 = "=R" & Range("F26").Value & "C3"
Range("F26").Value = Range("F26").Value + 1

ActiveCell.Offset(1, 0).Select

next i

Asumming that intRowCount= 4 (it is a variable)

I will get four new rows Column B
row 15 XXXXXXXXX
row 16 YYYYYYYYYY
row 17 ZZZZZZZZZ
row 18 PPPPPPPPP

But I need all these four rows be ONE. Is there a way to concatanate
them in a LOOP?
Thank you,
Sonya


--
Sonya795
------------------------------------------------------------------------
Sonya795's Profile: http://www.excelforum.com/member.php...o&userid=26110
View this thread: http://www.excelforum.com/showthread...hreadid=397276


Bob Phillips

Hi Sonya,

Perhaps this

With ActiveCell
.Value = ""
For i = 1 To intRowCount
.Value = .Value & "R" & Range("F26").Value + _
i - 1 & "C3" & "&"
Next i
.FormulaR1C1 = "=" & Left(.Value, Len(.Value) - 1)
End With


--

HTH

RP
(remove nothere from the email address if mailing direct)


"Sonya795" wrote in
message ...

Bob,

Here is the exact code that I am using:

For i = 1 To intRowCount

ActiveCell.FormulaR1C1 = "=R" & Range("F26").Value & "C3"
Range("F26").Value = Range("F26").Value + 1

ActiveCell.Offset(1, 0).Select

next i

Asumming that intRowCount= 4 (it is a variable)

I will get four new rows Column B
row 15 XXXXXXXXX
row 16 YYYYYYYYYY
row 17 ZZZZZZZZZ
row 18 PPPPPPPPP

But I need all these four rows be ONE. Is there a way to concatanate
them in a LOOP?
Thank you,
Sonya


--
Sonya795
------------------------------------------------------------------------
Sonya795's Profile:

http://www.excelforum.com/member.php...o&userid=26110
View this thread: http://www.excelforum.com/showthread...hreadid=397276




Sonya795


Bob,
Thank you a lot.
You suggestion works perfectly!!!
Thanks a million.
Sonya


--
Sonya795
------------------------------------------------------------------------
Sonya795's Profile: http://www.excelforum.com/member.php...o&userid=26110
View this thread: http://www.excelforum.com/showthread...hreadid=397276



All times are GMT +1. The time now is 08:47 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com