Selecting an option within a Combo Box with VB in Excel

Hi, I just recorded a Macro in Excel where one clicks on a certain business called "Mortgage Business" within a Combo box in Excel and then copies and pastes the data to another spreadsheet.however, it does not work. Can anyone help?
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Saurabh Singh TeotiaCommented:
Can you post your workbook or the macro that you recorded as it will help to do what you are looking for...

Also here is the sample code for your reference which you can use to copy data...

I have assumed the value which you looking for is in A Column in Worksheet-1 starting from row-2 and you want to copy

Sub copydata()

    Dim rng As Range, cell As Range
    Dim lrow As Long
    Dim ws As Worksheet, ws1 As Worksheet

    Set ws = Sheets("Sheet1")
    Set ws1 = Sheets("Sheet2")

    lrow = ws.Cells(Cells.Rows.Count, "a").End(xlUp).Row

    Set rng = ws.Range("A2:A" & lrow)

    For Each cell In rng

        If UCase(Trim(cell.Value)) = UCase(COMBOBOX1.Value) Then
            ws.Cells.EntireRow.Copy ws1.Range("A" & ws1.Cells(Cells.Rows.Count, "a").End(xlUp).Row + 1)
        End If

    Next cell

End Sub

Open in new window

JustincutAuthor Commented:
Ok, here's the file. The combo box is in the top left hand corner. I want to choose "MORTGAGE PRODUCTS -EMEA" in the combo box, this will change the data  and then Copy and Paste Cells (i13:y200).
Martin LissOlder than dirtCommented:
Add a module to your workbook and then add this macro.

Sub SelectMortgageProducts()

Sheets("Balance Sheet").Shapes("List Box 1").OLEFormat.Object.Selected(30) = True

End Sub

Open in new window


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Martin LissOlder than dirtCommented:
You're welcome and I'm glad I was able to help.

In my profile you'll find links to some articles I've written that may interest you.
Marty - MVP 2009 to 2014
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.