modify a text display function

  • Thread starter Thread starter Mason Pratt
  • Start date Start date
M

Mason Pratt

Two days ago I asked:

I have a series of text cells I wish to combine into one cell.

Example: In D4 I wish to put the combination of B1 thru B5.

My formula is =B1&B2&B3&B4&B5.



I received a couple of responses (many thanks).

Below is a function I am now using.

I would like to know how to modify this so I can

read every second, third or fourth cell in the series

as well.

That is read a series (row or column) and be able

to combine them by skipping a set number of cells.



Function ConRange(CellBlock As Range) As String
For Each cell In CellBlock
ConRange = ConRange & cell.Value
Next
End Function



Thanks again for the help.
 
The following UDF combines data based on the range and skip value that
you enter as arguments:

'===================================
Function ConRangeSkip(CellBlock As Range, _
Skip As Integer) As String
Dim c As Range
Dim i As Integer
i = 1

For Each c In CellBlock
If i Mod Skip = 0 Then
ConRangeSkip = ConRangeSkip & c.Value
Else
ConRangeSkip = ConRangeSkip
End If
i = i + 1
Next
End Function
'===================================
 
Back
Top