Macro to automate a report

strider1

New Member
Joined
Jun 7, 2012
Messages
9
Hi Guys,

Very new to macros. The issue i am facing is that, i have developed a report for around 50 products. the products are in a drop down list. when a product is selected from the list, the report is refreshed with the details about that product.
What i am wanting to do is that, I want to automate the report. I am looking for a macro that would go down the list for all the products and then save the details of each each product in a new workbook, where each product is reprensted by a wroksheet with product name as the worksheet name and then save it as a pdf file.
Any suggestions or code anyone can help me out with?
thank you
 
This code will loop through each cell in the validation range, then update cell A1 on your dashboard sheet, and create a new worksheet.

You'll need to adjust the sheet name and the validation cell you want to change, but it should give you an idea:

<font face=Calibri><SPAN style="color:#00007F">Sub</SPAN> foo()<br>    <SPAN style="color:#00007F">Dim</SPAN> c <SPAN style="color:#00007F">As</SPAN> Range<br>    <SPAN style="color:#00007F">Dim</SPAN> ws <SPAN style="color:#00007F">As</SPAN> Worksheet<br>    <br>        <SPAN style="color:#00007F">Set</SPAN> ws = Sheets("Dashboard")<br>        <br>        <SPAN style="color:#00007F">For</SPAN> <SPAN style="color:#00007F">Each</SPAN> c <SPAN style="color:#00007F">In</SPAN> ws.Range("Handsets")<br>            <SPAN style="color:#00007F">With</SPAN> ws<br>                .Range("A1").Value = c.Value<br>                .Copy After:=Sheets(Sheets.Count)<br>            <SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">With</SPAN><br>            ActiveSheet.Name = c.Value<br>        <SPAN style="color:#00007F">Next</SPAN> c<br>            <br><SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">Sub</SPAN><br></FONT>
 
Upvote 0

Excel Facts

Can Excel fill bagel flavors?
You can teach Excel a new custom list. Type the list in cells, File, Options, Advanced, Edit Custom Lists, Import, OK

Forum statistics

Threads
1,217,424
Messages
6,136,554
Members
450,020
Latest member
ddobrzynski

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