Hello
I need modifying code by create folders(year ) & create folders(month ) inside folders(year ) into this directory "C:\Users\kl\Desktop\invoices" based on date are existed in cell G5 and save the pdf files in month folders into folders(year ) based on G5. and should replace the file every time run the macro .
the month folders names should be JAN,FEB....
I need modifying code by create folders(year ) & create folders(month ) inside folders(year ) into this directory "C:\Users\kl\Desktop\invoices" based on date are existed in cell G5 and save the pdf files in month folders into folders(year ) based on G5. and should replace the file every time run the macro .
the month folders names should be JAN,FEB....
VBA Code:
Public Sub Save_PDF1()
Dim Nm As String
Dim Rng As Range
Dim hideRowsRange As Range, r As Long
Set Rng = Range("A1:G44") '<- Set your range here
Set hideRowsRange = Range("A21:G34")
For r = 1 To hideRowsRange.Rows.Count
If Application.CountA(hideRowsRange.Rows(r)) = 0 Then hideRowsRange.Rows(r).EntireRow.Hidden = True
Next
Nm = ActiveWorkbook.FullName
Nm = Left(Nm, InStrRev(Nm, ".") - 1) & Format(Now, " yyyymmddhhmmss") & ".pdf"
Rng.ExportAsFixedFormat Type:=xlTypePDF, Filename:=Nm, Quality:=xlQualityStandard, _
IncludeDocProperties:=True, IgnorePrintAreas:=True, OpenAfterPublish:=True
For r = 1 To hideRowsRange.Rows.Count
If Application.CountA(hideRowsRange.Rows(r)) = 0 Then hideRowsRange.Rows(r).EntireRow.Hidden = False
Next
End Sub