Save several workbooks according to a filtered list

Status
Not open for further replies.

Flavien

Board Regular
Joined
Jan 8, 2023
Messages
55
Office Version
  1. 365
Platform
  1. Windows
Hello Everybody!

I would like to save several workbooks according to a filtered list, but unfortunately the macro reads all the lines of the chart including hidden lines.

Do you have a solution?

Thank you for your help!

Please find below the program:

Sub Creer_classeur_GCU()


Dim wbToDupe As Workbook
Dim wsExtr As Worksheet
Dim rVar As Range
Dim NewName As String
Dim i As Long

Application.ScreenUpdating = False

Workbooks.Open Filename:="P:\01-Qualité\K - Qualité Usinage\05 - CREATION PCP PREMIER NIVEAU\12-DC-11 - Gamme contrôle usinage - v00.xlsx"


Const DestFolder As String = "P:\01-Qualité\K - Qualité Usinage\05 - CREATION PCP PREMIER NIVEAU" '<- Edit as required

Set wbToDupe = Workbooks("12-DC-11 - Gamme contrôle usinage - v00.xlsx") '<- Edit as required
Set wsExtr = ThisWorkbook.Sheets("EXTRACTION")
Set rVar = wbToDupe.Sheets("TABLE - Cartouche").ListObjects(1).DataBodyRange.Cells(1, 2) 'renvoie à une colonne à l'exception de l'entête
With wsExtr
For i = 2 To .Range("A" & Rows.Count).End(xlUp).Row
.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:=NewName, FileFormat:=xlOpenXMLWorkbook, CreateBackup:=False
Set wbToDupe = Workbooks(NewName)
Set rVar = wbToDupe.Sheets("TABLE - Cartouche").ListObjects(1).DataBodyRange.Cells(1, 2)
Next i
End With
wbToDupe.Close
Application.ScreenUpdating = True

End Sub

****

Thank you for help!!
 

Attachments

  • Exemple filtre tableau EXTRACTION.JPG
    Exemple filtre tableau EXTRACTION.JPG
    31.5 KB · Views: 4

Excel Facts

Select a hidden cell
Somehide hide payroll data in column G? Press F5. Type G1. Enter. Look in formula bar while you arrow down through G.
Status
Not open for further replies.

Forum statistics

Threads
1,215,411
Messages
6,124,759
Members
449,187
Latest member
hermansoa

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