Concatenate Visible

JJabra

New Member
Joined
Aug 19, 2019
Messages
37
Hi,

I am looking to write a formula that will include into one cell all the values that are visible in column A after filtering. Looking online I have only been able to find the below;

VBA Code:
Public Function ConcatenateVisible(rng As Variant, seperator As String, Optional IGNORE_EMPTY As Boolean = False)
    For Each cll In rng
        If cll.EntireRow.Hidden = False And Not (IsEmpty(cll) And IGNORE_EMPTY) Then _
            ConcatenateVisible = ConcatenateVisible & cll.Value & seperator
    Next
    ConcatenateVisible = Left(ConcatenateVisible, Len(ConcatenateVisible) - Len(seperator))
End Function

however when I now try to use the ConcatenateVisible formula it brings a #NAME? error.

Please can somebody advise of another way to do this or advise how to make the current macro/formula work?

Thanks in advance!
 

Excel Facts

Round to nearest half hour?
Use =MROUND(A2,"0:30") to round to nearest half hour. Use =CEILING(A2,"0:30") to round to next half hour.
you are combining two functions into one, I don't have the first function you are using on my computer. I get _xlfun error
1576840269794.png

Possibly using & then the other function instead of putting it in the same concatenate function will stop the automation error.
=CONCATENATE("There are ",AB1, " eight-week letters to send. The customers that need 8-week letters are: ") & ConcatenateVisible(A2:A513, ", ")

The #value still appears after you click the filter button, I noticed pressing F9 to calculate the sheet the formula fixes itself.
You can tell the sheet to calculate after the filter codes have run.

VBA Code:
Sub MacroButton()

    Call Escalations
    Call Resolved
    Call LetterSent
    Call Ombudsman
    Call EmailNotification
    Calculate
End Sub
 
Upvote 0
You are a hero!

I have modified the code to include the & and also added calculate before the email sends and it now works great!

Thank you very much for all the help and persisting with it!
 
Upvote 0

Forum statistics

Threads
1,216,474
Messages
6,130,841
Members
449,598
Latest member
sunny_ksy

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top