Macro to generate Client specific output based on yes/no in a table in sheet3

maloo70

New Member
Joined
Jun 10, 2015
Messages
1
Hi All

Hope you'll are doing well.

Can someone help me out with a macro for the attached file that will do the following:
There is a Output sheet which needs to be copied on a new sheet where the name of the new sheet will be "Output for <Client Name>"
The newly created sheet should have the same format as the Output sheet but there should not be any formula in the newly created sheet (paste special values and formats).
These client specific output sheets to be created for all the clients for which the output is required as mentioned in Sheet3.
A button on Sheet3 which is linked to the macro to generate client specific output sheets.
If there are already some client specific output sheets, these should get deleted before regenerating the client specific output sheets.

It will also be helpful if description is provided for the codes, as it will help me find the work done by the codes.
Sheet1(Sheet1)
ABC12345
XYZ123456
LMN1234567



<colgroup><col style="width: 48pt;" span="4" width="64">
<tbody>


</tbody>

Sheet2(Output)
ClientABC
ClientAmount
ABC12345



<colgroup><col style="width: 48pt;" span="5" width="64">
<tbody>


</tbody>
The Client tab above has validation, refering from Sheet 1 for ABC,LMN,XYZ

Sheet3(Sheet3)
ClientOutput Required
ABCYes
XYZNo
LMNYes

<tbody>
</tbody><colgroup><col span="2"><col><col></colgroup>
1)A command button in sheet3 which will look for specific yes in "Output Required" tab and then look for specific Yes related tabs in Sheet2, and print it as output sheet with paste values

2) If another time sheet3 requires
ClientOutput Required
ABCNo
XYZNo
LMNYes

<tbody>
</tbody><colgroup><col span="2"><col></colgroup>
Then firstly all newly created sheets must be deleted then new output sheet for selected yes must be generated.

Kindly help me with this, the macro which I have tried is pasted below but thats something different to what I have asked

'//Initialise Worksheet Object
Dim ws As Worksheet
'// To avoid disply alerts
Application.DisplayAlerts = False
'// For Each Sheet in the Workbook
For Each ws In Worksheets
'
If ws.Name <> "Sheet1" And ws.Name <> "Output" And ws.Name <> "Sheet3" Then ws.Delete
Next
Application.DisplayAlerts = True
Dim range1 As Variant
Sheets("Output").Select
range("c6:d7").Select
Selection.Copy
range1 = Sheets("Output").range("c2").Value
'c2 is a dropdown list
Sheets.Add
ActiveSheet.Name = " output for " & range1
Selection.Offset(5, 2).PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Sheets("Output").Select

Thanks
 

Excel Facts

Back into an answer in Excel
Use Data, What-If Analysis, Goal Seek to find the correct input cell value to reach a desired result

Forum statistics

Threads
1,203,101
Messages
6,053,530
Members
444,670
Latest member
laurenmjones1111

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