• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

How use same macro in different list name in combo box or excel list change

I have running macro name macro1 in file by button click ,but I want to run this by combo box or selection of cell run that macro1. there is three name in list as laptop, desktop, projector . When I select any one from three laptop or desktop or projector run same macro name macro1.
 
Hi Suresh ,

If you have asked a VBA question without either posting the code or uploading your file , I can only assume that you are conversant enough to follow up on a suggestion and write the code yourself.

Use the Worksheet_Change event procedure.

If you want more help , upload your file with the data and the controls and the macro in it.

Narayan
 
Thanks a lot for your response . Please find attached file for the same.
 

Attachments

  • Status - .xlsm
    574.7 KB · Views: 1
  • Status - .xlsm
    574.7 KB · Views: 0
Hi Suresh ,

You can remove the button and the dropdown list , but how have you removed it ?

The code for the combobox is putting the selected value into the cell where you had the dropdown , since this is the area you are referring to in your macro which implements the Advanced Filter.

If you can upload your file , I can see what has gone wrong.

Narayan
 
Ok I understand bcz which cell I removed that already using by macro that filtering the data . For your info I am attaching the same . Is this not possible other way

Thanks.
 

Attachments

  • Status - 2.xlsm
    573 KB · Views: 1
Hi Suresh ,

All that you have to do is rewrite your macro dashStaff to use some other cells.

Your VBA Advanced Filter is as follows :
Code:
     Sheets("Data 3").Range("D1:O188").AdvancedFilter Action:=xlFilterCopy, _
        CriteriaRange:=Range("A22:A23"), CopyToRange:=Range("B23:M23"), Unique:=False
Here , the criteria range has been mentioned as Range("A22:A23") ; if you intend to delete column A , then use some other area of the worksheet as your criteria range. Suppose you decide to use D1:D2.

Modify the above code to use D1:D2 , and in the Dropdown2_Change macro , change the following line of code to use the new location , as follows :

[A23] = DropDown2Selection

Change the above line to :

[D2] = DropDown2Selection

See the uploaded file. The changes will be different , since I have deleted column A , and all references will be shifted one column to the left.

Narayan
 

Attachments

  • Status - 2.xlsm
    572.5 KB · Views: 1
Hi Narayan
I want one more help about excel advance filter . Can we use pivot table as list range in advance filter . I used it work but when I refresh for next updated data its show error.
 
Back
Top