create a new sheet & save as pdf and add hyperlink & open

leap out

Active Member
Joined
Dec 4, 2020
Messages
288
Office Version
  1. 2016
  2. 2010
hi experts

I have two sheets the first is INV contains source data and the second should create based on current year is "2021 "
so I want save sheet INV as pdf to this directory "D:\process\inventory\2021" the folder 2021 contains many subfolders JAN,FEB .. up to DEC then should save the file as pdf to subfolder based on current month for instance current month is MAY then should save file in subfolder name's MAY and I would create a new sheet name's 2021 based on current year and when save file should copy the name file in sheet 2021 under the month relating of it as in topic header based on current month and add hyperlink to open the file
note : the file name should like this the text "INVENTORY OIL OF DATE " & DATE(today) then should like this "INVENTORY OIL OF DATE 05/22/2021 .PDF" and when finish this year 2021 should create a new year based on current year 2022 and so on
MONTHS.xlsm
ABCDE
1ITEMBRANDTYPEMONAFACTUREQ1
2110W40 12x1LCASSU567
3210W40 12x1LENIIT54
4310W40 12x1LQ8EU1234
5410W40 208LCASSU234
6510W40 208LENIIT123
7610W40 208LQ8EU132
8710W40 4x4LCASSU45
9810W40 4x4LENIIT67
10910W40 4x4LQ8EU123
111020W50 4x4LCASSU87
121120W50 4x4LENIIT98
INV1


MONTHS.xlsm
ABCDEFGHIJKL
1JANFEBMARAPRMAYJUNJULAUGSEPOCTNOVDEC
2INVENTORY OIL OF DATE 01/01/2021 .PDFINVENTORY OIL OF DATE 02/01/2021 .PDFINVENTORY OIL OF DATE 03/01/2021 .PDF
3INVENTORY OIL OF DATE 01/02/2021 .PDFINVENTORY OIL OF DATE 02/02/2021 .PDFINVENTORY OIL OF DATE 03/02/2021 .PDF
4INVENTORY OIL OF DATE 01/03/2021 .PDFINVENTORY OIL OF DATE 02/03/2021 .PDFINVENTORY OIL OF DATE 03/03/2021 .PDF
5INVENTORY OIL OF DATE 01/04/2021 .PDFINVENTORY OIL OF DATE 02/04/2021 .PDFINVENTORY OIL OF DATE 03/04/2021 .PDF
6INVENTORY OIL OF DATE 01/05/2021 .PDFINVENTORY OIL OF DATE 02/05/2021 .PDFINVENTORY OIL OF DATE 03/05/2021 .PDF
7INVENTORY OIL OF DATE 01/06/2021 .PDFINVENTORY OIL OF DATE 02/06/2021 .PDFINVENTORY OIL OF DATE 03/06/2021 .PDF
8INVENTORY OIL OF DATE 01/07/2021 .PDFINVENTORY OIL OF DATE 02/07/2021 .PDFINVENTORY OIL OF DATE 03/07/2021 .PDF
9INVENTORY OIL OF DATE 01/08/2021 .PDFINVENTORY OIL OF DATE 02/08/2021 .PDFINVENTORY OIL OF DATE 03/08/2021 .PDF
10INVENTORY OIL OF DATE 01/09/2021 .PDFINVENTORY OIL OF DATE 02/09/2021 .PDFINVENTORY OIL OF DATE 03/09/2021 .PDF
11INVENTORY OIL OF DATE 01/10/2021 .PDFINVENTORY OIL OF DATE 02/10/2021 .PDFINVENTORY OIL OF DATE 03/10/2021 .PDF
12INVENTORY OIL OF DATE 01/11/2021 .PDFINVENTORY OIL OF DATE 02/11/2021 .PDFINVENTORY OIL OF DATE 03/11/2021 .PDF
13INVENTORY OIL OF DATE 01/12/2021 .PDFINVENTORY OIL OF DATE 02/12/2021 .PDFINVENTORY OIL OF DATE 03/12/2021 .PDF
14INVENTORY OIL OF DATE 01/13/2021 .PDFINVENTORY OIL OF DATE 02/13/2021 .PDFINVENTORY OIL OF DATE 03/13/2021 .PDF
15INVENTORY OIL OF DATE 01/14/2021 .PDFINVENTORY OIL OF DATE 02/14/2021 .PDFINVENTORY OIL OF DATE 03/14/2021 .PDF
16INVENTORY OIL OF DATE 01/15/2021.PDFINVENTORY OIL OF DATE 02/15/2021.PDFINVENTORY OIL OF DATE 03/15/2021.PDF
17INVENTORY OIL OF DATE 01/16/2021 .PDFINVENTORY OIL OF DATE 02/16/2021 .PDFINVENTORY OIL OF DATE 03/16/2021 .PDF
18INVENTORY OIL OF DATE 01/17/2021 .PDFINVENTORY OIL OF DATE 02/17/2021 .PDFINVENTORY OIL OF DATE 03/17/2021 .PDF
19INVENTORY OIL OF DATE 01/18/2021 .PDFINVENTORY OIL OF DATE 02/18/2021 .PDFINVENTORY OIL OF DATE 03/18/2021 .PDF
20INVENTORY OIL OF DATE 01/19/2021 .PDFINVENTORY OIL OF DATE 02/19/2021 .PDFINVENTORY OIL OF DATE 03/19/2021 .PDF
21INVENTORY OIL OF DATE 01/20/2021 .PDFINVENTORY OIL OF DATE 02/20/2021 .PDFINVENTORY OIL OF DATE 03/20/2021 .PDF
22INVENTORY OIL OF DATE 01/21/2021 .PDFINVENTORY OIL OF DATE 02/21/2021 .PDFINVENTORY OIL OF DATE 03/21/2021 .PDF
23INVENTORY OIL OF DATE 01/22/2021 .PDFINVENTORY OIL OF DATE 02/22/2021 .PDFINVENTORY OIL OF DATE 03/22/2021 .PDF
24INVENTORY OIL OF DATE 01/23/2021 .PDFINVENTORY OIL OF DATE 02/23/2021 .PDFINVENTORY OIL OF DATE 03/23/2021 .PDF
25INVENTORY OIL OF DATE 01/24/2021 .PDFINVENTORY OIL OF DATE 02/24/2021 .PDFINVENTORY OIL OF DATE 03/24/2021 .PDF
26INVENTORY OIL OF DATE 01/25/2021 .PDFINVENTORY OIL OF DATE 02/25/2021 .PDFINVENTORY OIL OF DATE 03/25/2021 .PDF
27INVENTORY OIL OF DATE 01/26/2021 .PDFINVENTORY OIL OF DATE 02/26/2021 .PDFINVENTORY OIL OF DATE 03/26/2021 .PDF
28INVENTORY OIL OF DATE 01/27/2021 .PDFINVENTORY OIL OF DATE 02/27/2021 .PDFINVENTORY OIL OF DATE 03/27/2021 .PDF
29INVENTORY OIL OF DATE 01/28/2021 .PDFINVENTORY OIL OF DATE 02/28/2021 .PDFINVENTORY OIL OF DATE 03/28/2021 .PDF
30INVENTORY OIL OF DATE 01/29/2021 .PDFINVENTORY OIL OF DATE 03/29/2021 .PDF
31INVENTORY OIL OF DATE 01/30/2021 .PDFINVENTORY OIL OF DATE 03/30/2021 .PDF
32INVENTORY OIL OF DATE 01/31/2021 .PDFINVENTORY OIL OF DATE 03/31/2021 .PDF
2021

if it's not clear please tell me
thanks in advance
 
Last edited by a moderator:
if I don't save the file as pdf for specific month in specific day then leave the cell and move to another cell then it shows some cells are empty
Sorry, I don't understand you. When you run the macro, it saves the INV sheet as a .pdf file and creates a link to that file in the sheet, column and row related to the current date, so there aren't any empty cells if you run the macro.
 
Upvote 0

Excel Facts

How to create a cell-sized chart?
Tiny charts, called Sparklines, were added to Excel 2010. Look for Sparklines on the Insert tab.
I expected you don't understand me so look the first image and the second image should be

as you see the image contain empty cell between specific dates it begins from row3 because it matches with second day for date 06/02/2021 when count the row for day of month then it leave row2 because the code considers this the first day of month the same thing for date 06/05/2021 when count the row for day of month then it leave rows from 4:5 because the code considers this the fifth day of month matches with row 6 so I don't want any empty blanks among dates when I have no data every day of month I want the dates under of each other consecutively
first image



second image
 
Upvote 0
I see now - your picture explains it.

Replace:
VBA Code:
    With yearSheet
        .Hyperlinks.Add Anchor:=.Cells(Day(currentDate) + 1, Month(currentDate)), Address:=PDFfullName, TextToDisplay:=Mid(PDFfullName, InStrRev(PDFfullName, "\") + 1)
    End With
with:
VBA Code:
    With yearSheet
        Dim r As Long
        r = .Cells(.Rows.Count, Month(currentDate)).End(xlUp).row + 1
        .Hyperlinks.Add Anchor:=.Cells(r, Month(currentDate)), Address:=PDFfullName, TextToDisplay:=Mid(PDFfullName, InStrRev(PDFfullName, "\") + 1)
    End With
 
Upvote 0

Forum statistics

Threads
1,223,896
Messages
6,175,264
Members
452,627
Latest member
KitkatToby

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