Create a workbook from a list and then name it according to the contents of 2 cells

Flavien

Board Regular
Joined
Jan 8, 2023
Messages
76
Office Version
  1. 365
Platform
  1. Windows
Hi all
I am contacting you because I cannot find an answer to my questions and unfortunately I am unable to adapt the similar cases already addressed.

I now that Xmas was 2 weeks ago, but if someone could help me, I'll be grateful!

I have 2 workbooks : "Gestionnaire de creation" (masterworkbook) & "Classeur1 GCU - V00" (The one that I want to duplicate).
The first contains a list of data:
(A) Plan No / (B) Index / (C) Description / (D) Clients / ... (cf pictures uploaded)

The second contains a table with 2 columns.
(A) Fixe / (B) Variable
There are the 6 elements of a row in the column (B).

I would like to copy each row (one by one), from the master workbook, and then paste it into the second file in column (B) of the table sheet("CARTOUCHE") and to finish save the second file as the value from the cells A2 and B2 and add "GCU - V00"
I need to repeat this procedure as many times as there are rows. (The number of rows may vary from list to list).

Both workbooks are not registered in the same folder and duplicated workbooks should to be registered in a third folder.

By advance thank you.
 

Attachments

  • Capture d’écran Classeur1 GCU - GCU.png
    Capture d’écran Classeur1 GCU - GCU.png
    17.7 KB · Views: 20
  • Capture d’écran Gestionnaire de creation.png
    Capture d’écran Gestionnaire de creation.png
    42.7 KB · Views: 28
Hello Peter_SSs!

I've look in the Internet and on MrExcel, unfortunately I didn't find any answers to "save as" workbooks according to a filtered list, unfortunately the macro above reads all the lines of the table including hidden lines.

Could you please help me?

Have a nice day.
 
Upvote 0

Excel Facts

What do {} around a formula in the formula bar mean?
{Formula} means the formula was entered using Ctrl+Shift+Enter signifying an old-style array formula.
unfortunately the macro above reads all the lines of the table including hidden lines.
Try adding these two blue lines of code where shown

Rich (BB code):
With wsExtr
  For i = 2 To .Range("A" & Rows.Count).End(xlUp).Row
    If Not .Rows(i).Hidden Then
      .Range("A" & i).Resize(, 6).Copy
      rVar.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks:=False, Transpose:=True
      NewName = "P" & rVar.Cells(1, 1).Value & " - " & rVar.Cells(2, 1).Value & " - " & " GCU - V00.xlsx"
      wbToDupe.SaveAs Filename:=DestFolder & NewName, FileFormat:=xlOpenXMLWorkbook, CreateBackup:=False
      Set wbToDupe = Workbooks(NewName)
      Set rVar = wbToDupe.Sheets("TABLE - Cartouche").ListObjects(1).DataBodyRange.Cells(1, 2)
    End If
  Next i
End With
 
Upvote 0
Hello !
Can you tell me how to copy a template folder and rename it with the same name as the new workbook created by the macro above?
Thank you for your help!
 
Upvote 0
Hello @Peter_SSs,

I really need your help, I don't find any answers on the web.
How can I do to duplicate a rename an existing folder in order to save within the workbook created by the macro?
Workbook name = folder name

Thank you for your help.
 
Upvote 0

Forum statistics

Threads
1,223,327
Messages
6,171,484
Members
452,407
Latest member
Broken Calculator

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