Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Concatentate A1:AZ1 separated by ~

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.





  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 523
Default Concatentate A1:AZ1 separated by ~

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.






  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default Concatentate A1:AZ1 separated by ~

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" wrote in message
...
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.








  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 342
Default Concatentate A1:AZ1 separated by ~

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.






  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Concatentate A1:AZ1 separated by ~


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





"shortstop" wrote in message
...
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
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Concatentate text and insert blank line Bethany Excel Worksheet Functions 5 November 10th 09 06:38 PM
Using Concatentate in Formula SteveC Excel Discussion (Misc queries) 14 June 24th 06 01:40 AM
Concatentate Join Identifier Kiser Excel Worksheet Functions 2 November 23rd 05 02:23 AM
LookUp and Concatentate carl Excel Worksheet Functions 1 June 21st 05 10:48 PM
Concatentate a formula with a variable sheet name. Don Pistulka Excel Programming 2 August 10th 03 10:03 PM


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

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"