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)
<colgroup><col style="width: 48pt;" span="4" width="64">
<tbody>
</tbody>
Sheet2(Output)
<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)
<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
<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
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)
ABC | 12345 | ||
XYZ | 123456 | ||
LMN | 1234567 | ||
<colgroup><col style="width: 48pt;" span="4" width="64">
<tbody>
</tbody>
Sheet2(Output)
Client | ABC | |||
Client | Amount | |||
ABC | 12345 | |||
<colgroup><col style="width: 48pt;" span="5" width="64">
<tbody>
</tbody>
Sheet3(Sheet3)
Client | Output Required | ||
ABC | Yes | ||
XYZ | No | ||
LMN | Yes | ||
<tbody>
</tbody><colgroup><col span="2"><col><col></colgroup>
2) If another time sheet3 requires
Client | Output Required | |
ABC | No | |
XYZ | No | |
LMN | Yes | |
<tbody>
</tbody><colgroup><col span="2"><col></colgroup>
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