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 Modify a UDF please?

Could this be slightly modified please:

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

To achieve this
a¦a|b¦b|c¦c
rather than
a¦b|c¦

Thanks Guys
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 256
Default Modify a UDF please?

Important question. Does your input range contain three cells, with
values a, b, c - or does it contain six cells with values a, a, b, b,
c, c?


On Jan 22, 7:11*pm, Excel Helps
wrote:
Could this be slightly modified please:

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

To achieve this
a¦a|b¦b|c¦c
rather than
a¦b|c¦

Thanks Guys


  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 27
Default Modify a UDF please?

Hi Ilia
The input contains 3 cells for this example.
In fact the live file has up to 8 input cells.

So the output is: a¦a|b¦b|c¦c
From input: a b c

Thanks

"ilia" wrote:

Important question. Does your input range contain three cells, with
values a, b, c - or does it contain six cells with values a, a, b, b,
c, c?


On Jan 22, 7:11 pm, Excel Helps
wrote:
Could this be slightly modified please:

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

To achieve this
a¦a|b¦b|c¦c
rather than
a¦b|c¦

Thanks Guys



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
Modify a UDF please? Excel Helps Excel Worksheet Functions 0 January 23rd 08 12:10 AM
Modify a Macro Carl Excel Worksheet Functions 1 October 28th 06 10:32 AM
Last person to modify Chip Smith Excel Discussion (Misc queries) 1 June 21st 06 07:22 PM
Cannot modify Comments Mad Ant Excel Discussion (Misc queries) 1 June 16th 06 12:39 PM
Help to Modify these guys Jay Excel Worksheet Functions 4 April 20th 05 06:37 PM


All times are GMT +1. The time now is 08:27 AM.

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"