Creating a macro to change values in a drop down list and export the resulting output

Tommy Pickles

New Member
Joined
Sep 26, 2013
Messages
1
Hi,

I've been searching the web and so far had no joy in finding a solution to what I need, I'm hoping someone can help. I am pretty basic with macros having only used them a handful of times at a very simple level.

I have built a report that will provide users with a data output based on the selection given in 3 drop down lists (created using data validation). One is the month (Jan-Dec), the second is a region (North, South, East, West) and the third is a Customer name (Customer A, Customer B, Customer C etc etc).

The date only has a bearing on the output data shown in the report, however the region drop down list is tied to the customer list. So, if a user selects East, this feeds a vlookup on another sheet which in turn populates the third drop down list with the Customer names within that region.

I have created the following macro which will allow a user to take a hard copy of one customers data once they have made all of the necessary selections on the drop down menus (removes all lookups, other names, financial data etc). This hard copy can then be shared with the relevant customer without the worry that they could use the data hidden behind the report.

The code for this function is as follows:
Sub ExportData()
'
' ExportData Macro
'
'
Sheets("MB Summary").Select
Sheets("MB Summary").Copy
Cells.Select
Selection.Copy
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Range("W16").Select
ActiveWindow.SmallScroll Down:=6
Rows("26:40").Select
ActiveWindow.SmallScroll Down:=-3
Rows("17:40").Select
Application.CutCopyMode = False
Selection.Delete Shift:=xlUp
Range("D16:P16").Select
Selection.ClearContents
Range("V22").Select
ActiveSheet.Shapes.Range(Array("Button 1")).Select
Columns("V:X").Select
Selection.Delete Shift:=xlToLeft
Range("Y20").Select
ActiveSheet.Shapes.Range(Array("Button 1")).Select
Selection.Delete
Range("A1:S59").Select
ActiveWindow.SmallScroll Down:=-39
ActiveSheet.PageSetup.PrintArea = "$A$1:$S$59"
Range("W23").Select
End Sub


As I produce this report for people who represent a region (and therefore a number of customers) I want to add a macro which will carry out this function, but for every customer in the region so that it becomes less time consuming for the report users to generate multiple reports for distribution.

The lookups in the sheet are controlled by the drop down menu though so my goal is that a user could select the region, click a button, and the macro would take the list of names and carry out the above function for each name on the list.

Could anyone assist please?

Thanks
 

Excel Facts

What does custom number format of ;;; mean?
Three semi-colons will hide the value in the cell. Although most people use white font instead.

Forum statistics

Threads
1,223,728
Messages
6,174,157
Members
452,548
Latest member
Enice Anaelle

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