Help my family overview - Showing multi-select dropdown values from different worksheets on one sheet

GHVDS

New Member
Joined
Nov 1, 2022
Messages
4
Office Version
  1. 2010
Platform
  1. Windows
Dear Excel wizards 🧙‍♂️

I hope that you can help me. I want to create an family overview from different individual worksheets. On these worksheets, I have a combination of single dropdowns and multi-select dropdowns as can be seen below.

1667936177348.png


However, when I link fields from the overview sheet to the "child sheets" (e.g. "C6=Tiffany!C6", etc...) and use the same VBA code on the overview sheet, the mult-select values are not listed below each other but next to each other.

1667935956219.png


The VBA code that I used on the overview sheet is:

VBA Code:
Private Sub Worksheet_Change(ByVal Target As Range)

    Dim OldValue As String
    Dim NewValue As String
    Dim p1 As Long, p2 As Long

    If Intersect(Target, Range("C9:H9", "C10:H10")) Is Nothing Then Exit Sub
    If Target.SpecialCells(xlCellTypeAllValidation) Is Nothing Then Exit Sub
    If Target.Value = "" Then Exit Sub
    
    Application.EnableEvents = False
    
    NewValue = Target.Value
    Application.Undo
    OldValue = Target.Value
    
    If OldValue = "" Then
        Target.Value = NewValue
    Else
        p1 = InStr(vbNewLine & OldValue & vbNewLine, vbNewLine & NewValue & vbNewLine)
        If p1 = 0 Then
            'Append new value
            Target.Value = OldValue & vbNewLine & NewValue
        Else
            'Remove already selected value
            p2 = p1 + Len(vbNewLine & NewValue & vbNewLine)
            If p1 = 1 Then
                'Remove from start
                OldValue = Mid(OldValue, p2 - 2)
            ElseIf p2 = Len(vbNewLine & OldValue & vbNewLine) + 1 Then
                'Remove from end
                OldValue = Left(OldValue, p1 - 3)
            ElseIf p1 > 1 Then
                'Remove from middle
                OldValue = Left(OldValue, p1 - 1) & Mid(OldValue, p2 - 2)
            End If
            Target.Value = OldValue
        End If
    End If
    
    Application.EnableEvents = True

End Sub

Please help me to make sense of my family!!

I thank you for your advice!
 

Attachments

  • 1667935815278.png
    1667935815278.png
    17.1 KB · Views: 8
  • 1667935913994.png
    1667935913994.png
    15.8 KB · Views: 6

Excel Facts

Copy formula down without changing references
If you have =SUM(F2:F49) in F50; type Alt+' in F51 to copy =SUM(F2:F49) to F51, leaving the formula in edit mode. Change SUM to COUNT.

Forum statistics

Threads
1,224,823
Messages
6,181,177
Members
453,021
Latest member
Justyna P

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