Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hello,
Very amateur VB user, need help! I need to write VB code to concatenate the data in 100 or more cells into a single string. This is easy for a small number of cells: ActiveCell.Offset(0, 0).FormulaR1C1 = _ ActiveCell.Offset(0, -1) & "," & ActiveCell.Offset(0, -2) etc. But how do I do this without needing to type the "ActiveCell.Offset" 100 times? Is there any way to included a for/next loop within the concatenation? Thanks! /LJ |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi,
Dim myString as string myString="" For r=1 to 100 myString=MyString & cells(r,1) <=== Rows 1 to 100 of column A next r "LJones" wrote: Hello, Very amateur VB user, need help! I need to write VB code to concatenate the data in 100 or more cells into a single string. This is easy for a small number of cells: ActiveCell.Offset(0, 0).FormulaR1C1 = _ ActiveCell.Offset(0, -1) & "," & ActiveCell.Offset(0, -2) etc. But how do I do this without needing to type the "ActiveCell.Offset" 100 times? Is there any way to included a for/next loop within the concatenation? Thanks! /LJ |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Soory ... forgot about comma:
Dim myString as string myString="" For r=1 to 100 myString=MyString & cells(r,1) & "," <=== Rows 1 to 100 of column A next r myString=left(myString,len(mystring)-1) "Toppers" wrote: Hi, Dim myString as string myString="" For r=1 to 100 myString=MyString & cells(r,1) <=== Rows 1 to 100 of column A next r "LJones" wrote: Hello, Very amateur VB user, need help! I need to write VB code to concatenate the data in 100 or more cells into a single string. This is easy for a small number of cells: ActiveCell.Offset(0, 0).FormulaR1C1 = _ ActiveCell.Offset(0, -1) & "," & ActiveCell.Offset(0, -2) etc. But how do I do this without needing to type the "ActiveCell.Offset" 100 times? Is there any way to included a for/next loop within the concatenation? Thanks! /LJ |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Perfect! Thx again,
LJ "Toppers" wrote: Soory ... forgot about comma: Dim myString as string myString="" For r=1 to 100 myString=MyString & cells(r,1) & "," <=== Rows 1 to 100 of column A next r myString=left(myString,len(mystring)-1) "Toppers" wrote: Hi, Dim myString as string myString="" For r=1 to 100 myString=MyString & cells(r,1) <=== Rows 1 to 100 of column A next r "LJones" wrote: Hello, Very amateur VB user, need help! I need to write VB code to concatenate the data in 100 or more cells into a single string. This is easy for a small number of cells: ActiveCell.Offset(0, 0).FormulaR1C1 = _ ActiveCell.Offset(0, -1) & "," & ActiveCell.Offset(0, -2) etc. But how do I do this without needing to type the "ActiveCell.Offset" 100 times? Is there any way to included a for/next loop within the concatenation? Thanks! /LJ |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Concatenate 4 cells | Excel Worksheet Functions | |||
Concatenate Cells | Excel Worksheet Functions | |||
Concatenate cells | Excel Discussion (Misc queries) | |||
post code & suburb concatenate | Excel Discussion (Misc queries) | |||
how do I UN-concatenate cells | Excel Discussion (Misc queries) |