modify a text display function

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.
 
D

Debra Dalgleish

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
'===================================
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Text display problem 4
Excel function - countif 2
Help with function 2
Return a value if a range of cells contain text 2
SUMIF 4
Need Help with a Formula 4
Simple display questions 4
function 1

Top