Trying to "Auto-Create" 40 Sheets

anticore

New Member
Joined
Aug 28, 2009
Messages
16
This is my dilema,

I have a report I built on excel that is populated with data from an access database. The report pulls monthly stats per "sales group" I made one cell into a validated list that once I change it to another sales group, the entire sheet is updated with the values of the new selected group....

I have 40 or so groups, If I wanted to quickly print or view all 40 reports, how do i do that?
 
what if i create a sub

Sub createReport()

create a new book,
copy the report sheet into the new book
and make a loop, changing the value of the field that determins what "sales group" is listed

would that work?
if so, can someone provide some guidence
 
Upvote 0
Hello and welcome to MrExcel.

Details are needed:

Which cell contains the data validation?

What is the range that defines the data validation list?

The name of the sheet might also be useful to know.
 
Upvote 0
Perhaps this ... press ALT + F11 to open the Visual Basic Editor, from the Insert menu select Module then paste the following into thw white space on the right

Code:
Sub Display()
Dim response As VbMsgBoxResult, c As Range
response = MsgBox("Click Yes to print or No to view", vbQuestion + vbYesNo)
With Sheets("report")
    For Each c In Range("salesGroup")
        .Range("G5") = c.Value
        Select Case response
            Case vbYes: .PrintOut
            Case vbNo: .PrintPreview
        End Select
    Next c
End With
End Sub

Press ALT + Q to close the code window then Tools >: Macro > Macros, click on Display then click the Run button.
 
Upvote 0
It is basically saying for each cell in that named range but Excel does not have a Cell object so I use c to save on the typing.

If you wish you can add a button from the Forms toolbar and assign this macro when prompted.
 
Upvote 0

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