PC Review


Reply
Thread Tools Rate Thread

Concatentate A1:AZ1 separated by ~

 
 
shortstop
Guest
Posts: n/a
 
      25th Jun 2008
Excel 2003 is my operating platform.

I have data in a row of my spreadsheet. A1:Z1 for example. I'd like to
concatenate it in VBA Code separated by a tilde "~" and have VBA put the
result in cell A10.

The code snippet below would suffice, I assume. However, it seems terribly
inefficient.

Range("A10").Value = Range("A1") & "~" & Range("B1")
........................... & "~" & Range("AZ1")

Can somebody provide guidance to make my code efficient.





 
Reply With Quote
 
 
 
 
Sam Wilson
Guest
Posts: n/a
 
      25th Jun 2008
sub joiner()

Dim s as string
s=Range("a1").value
Dim i as integer
for i = 1 to 26
s = s & "~" & range("a1").offset(0,i).value
next i

range("a10").value = s

end sub
"shortstop" wrote:

> Excel 2003 is my operating platform.
>
> I have data in a row of my spreadsheet. A1:Z1 for example. I'd like to
> concatenate it in VBA Code separated by a tilde "~" and have VBA put the
> result in cell A10.
>
> The code snippet below would suffice, I assume. However, it seems terribly
> inefficient.
>
> Range("A10").Value = Range("A1") & "~" & Range("B1")
> ........................... & "~" & Range("AZ1")
>
> Can somebody provide guidance to make my code efficient.
>
>
>
>
>
>

 
Reply With Quote
 
Bob Phillips
Guest
Posts: n/a
 
      25th Jun 2008
That will get AA1 as well Sam.

--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)

"Sam Wilson" <(E-Mail Removed)> wrote in message
news:44898DB1-E28E-46D5-AA86-(E-Mail Removed)...
> sub joiner()
>
> Dim s as string
> s=Range("a1").value
> Dim i as integer
> for i = 1 to 26
> s = s & "~" & range("a1").offset(0,i).value
> next i
>
> range("a10").value = s
>
> end sub
> "shortstop" wrote:
>
>> Excel 2003 is my operating platform.
>>
>> I have data in a row of my spreadsheet. A1:Z1 for example. I'd like to
>> concatenate it in VBA Code separated by a tilde "~" and have VBA put the
>> result in cell A10.
>>
>> The code snippet below would suffice, I assume. However, it seems
>> terribly
>> inefficient.
>>
>> Range("A10").Value = Range("A1") & "~" & Range("B1")
>> ........................... & "~" & Range("AZ1")
>>
>> Can somebody provide guidance to make my code efficient.
>>
>>
>>
>>
>>
>>



 
Reply With Quote
 
TomPl
Guest
Posts: n/a
 
      25th Jun 2008
This is sloppy, but it does the job and is adaptable.

Sub testit()

Dim rngMyCells As Range

ActiveSheet.Range("A10").Value = ActiveSheet.Range("A1").Value
For Each rngMyCells In ActiveSheet.Range("B1", "Z1")
ActiveSheet.Range("A10").Value = _
ActiveSheet.Range("A10").Value & "~" & rngMyCells.Value
Next

End Sub

"shortstop" wrote:

> Excel 2003 is my operating platform.
>
> I have data in a row of my spreadsheet. A1:Z1 for example. I'd like to
> concatenate it in VBA Code separated by a tilde "~" and have VBA put the
> result in cell A10.
>
> The code snippet below would suffice, I assume. However, it seems terribly
> inefficient.
>
> Range("A10").Value = Range("A1") & "~" & Range("B1")
> ........................... & "~" & Range("AZ1")
>
> Can somebody provide guidance to make my code efficient.
>
>
>
>
>
>

 
Reply With Quote
 
Joe S
Guest
Posts: n/a
 
      25th Jun 2008

Range("A10").Value =
Join(Application.Transpose(Application.Transpose(Range("A1:Z1").Value)),
"~")





"shortstop" <(E-Mail Removed)> wrote in message
news:%(E-Mail Removed)...
> Excel 2003 is my operating platform.
>
> I have data in a row of my spreadsheet. A1:Z1 for example. I'd like to
> concatenate it in VBA Code separated by a tilde "~" and have VBA put the
> result in cell A10.
>
> The code snippet below would suffice, I assume. However, it seems
> terribly inefficient.
>
> Range("A10").Value = Range("A1") & "~" & Range("B1")
> .......................... & "~" & Range("AZ1")
>
> Can somebody provide guidance to make my code efficient.
>
>
>
>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
RE: Concatentate text and insert blank line Luke M Microsoft Excel Worksheet Functions 0 10th Nov 2009 04:45 PM
Using Concatentate in Formula =?Utf-8?B?U3RldmVD?= Microsoft Excel Misc 14 24th Jun 2006 01:40 AM
Concatentate Join Identifier =?Utf-8?B?S2lzZXI=?= Microsoft Excel Worksheet Functions 2 23rd Nov 2005 02:23 AM
LookUp and Concatentate =?Utf-8?B?Y2FybA==?= Microsoft Excel Worksheet Functions 1 21st Jun 2005 10:48 PM
Concatentate a formula with a variable sheet name. Don Pistulka Microsoft Excel Programming 2 10th Aug 2003 10:03 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 10:23 AM.