Copy dropdown list from one sheet to another

DarkSmile

Board Regular
Joined
Feb 22, 2021
Messages
90
Office Version
  1. 365
Platform
  1. Windows
Hallo,

I'm back again, with another question that I can't find an answer for.. Here is what I'm trying
I got a sheet called ACS-002 (as a placeholder) with a button I'm copying specific cells over to my primary sheet called Food.

In ACS-002 I got a dropdown list, it works with different parts, (Shape, Listbox and vba code)

The listbox is setup as followed:
1614256605725.png


The VBA code is
VBA Code:
Sub ACS002_Click()
'Dropdown ACS002
Dim xSelShp As Shape, xSelLst As Variant, I, J As Integer
Dim xV As String
Set xSelShp = ActiveSheet.Shapes(Application.Caller)
Set xLstBox = Sheets("ACS-002").ListBoxACS004
If xLstBox.Visible = False Then
    xLstBox.Visible = True
    xSelShp.TextFrame2.TextRange.Characters.Text = "Bevestig Producttype(s)"
    xStr = ""
    xStr = Range("ACS002Output").Value
    
    If xStr <> "" Then
         xArr = Split(xStr, ";")
    For I = xLstBox.ListCount - 1 To 0 Step -1
        xV = xLstBox.List(I)
        For J = 0 To UBound(xArr)
            If xArr(J) = xV Then
              xLstBox.Selected(I) = True
              Exit For
            End If
        Next
    Next I
    End If
Else
    xLstBox.Visible = False
    xSelShp.TextFrame2.TextRange.Characters.Text = "Selecteer Producttype(s)"
    For I = xLstBox.ListCount - 1 To 0 Step -1
        If xLstBox.Selected(I) = True Then
        xSelLst = xLstBox.List(I) & ", " & xSelLst
        End If
    Next I
    If xSelLst <> "" Then
        Range("ACS002Output") = Mid(xSelLst, 1, Len(xSelLst) - 1)
    Else
        Range("ACS002Output") = ""
    End If
End If
End Sub

In ACS-002 it all works great not problem with that.
But when using the following code to copy/paste it from one sheet to the other
VBA Code:
Sub Alles_Aangeduid()
  Sheets("ACS-002").Range("A3:B15").Copy Destination:=Sheets("Food").Range("A15")
End Sub

It works but not as expected, here what it does:

It copies the cells and also changes between "Selecteer Producttype(s)" & "Bevestig Producttype(s)" but it opens and closes the textbox on sheet ACS-002 not on sheet Food..
Is there anyway to change something so it opens in the sheet where the button gets pressed?
 

Excel Facts

What did Pito Salas invent?
Pito Salas, working for Lotus, popularized what would become to be pivot tables. It was released as Lotus Improv in 1989.

Forum statistics

Threads
1,214,948
Messages
6,122,420
Members
449,083
Latest member
Ava19

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