Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 27
Default More help on a UDF please. Urgent!

Could one of the kind people that helped me over the weekend advise me
whether the code below can be altered to give this result please?
data1¦data1|data2¦data2|data3¦data3
where data1 has been entered in one column,data2 in one column, data3 in one
column but the output from the code duplicates data1,2,and 3 and also puts
alternating broken and solid pipes inbetween.

Thank you

Function ConCatRange(CellBlock As Range) As String
Dim Cell As Range
Dim sbuf As String
Dim pipe As Boolean
pipe = True
For Each Cell In CellBlock
pipe = Not pipe

If Len(Cell.Text) 0 Then
If pipe = False Then
sbuf = sbuf & Cell.Text & Chr(166)
Else
sbuf = sbuf & Cell.Text & "|"
End If
End If
Next
ConCatRange = sbuf
End Function


  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 256
Default More help on a UDF please. Urgent!

Does this work?

Function ConCatRange(CellBlock As Excel.Range) As String
Dim Cell As Excel.Range
Dim sbuf As String

For Each Cell In CellBlock
If Len(Cell.Text) Then
sbuf = sbuf & Cell.Text & Chr(166) & Cell.Text & "|"
End If
Next Cell
ConCatRange = Left$(sbuf, Len(sbuf) - 1)
End Function


On Jan 22, 7:09*pm, Excel Helps
wrote:
Could one of the kind people that helped me over the weekend advise me
whether the code below can be altered to give this result please?
data1¦data1|data2¦data2|data3¦data3
where data1 has been entered in one column,data2 in one column, data3 in one
column but the output from the code duplicates data1,2,and 3 and also puts
alternating broken and solid pipes inbetween.

Thank you

Function ConCatRange(CellBlock As Range) As String
Dim Cell As Range
Dim sbuf As String
Dim pipe As Boolean
pipe = True
* * For Each Cell In CellBlock
* * pipe = Not pipe

* * * * If Len(Cell.Text) 0 Then
* * * * * * If pipe = False Then
* * * * * * sbuf = sbuf & Cell.Text & Chr(166)
* * * * * * Else
* * * * * * sbuf = sbuf & Cell.Text & "|"
* * * * * * End If
* * * * End If
* * Next
* * ConCatRange = sbuf
End Function


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
URGENT HELP PLEASE triffidbook Excel Worksheet Functions 3 October 4th 06 04:28 PM
help - urgent daroc Excel Discussion (Misc queries) 3 March 7th 06 07:21 PM
Urgent!!! shenkly2 Excel Discussion (Misc queries) 4 January 30th 06 03:40 PM
Urgent-Urgent VBA LOOP Jeff Excel Discussion (Misc queries) 0 October 6th 05 05:46 PM
not urgent Gary's Student Excel Discussion (Misc queries) 2 August 17th 05 01:03 PM


All times are GMT +1. The time now is 02:01 PM.

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

About Us

"It's about Microsoft Excel"