Questo è il 1°:
Sub CreaVuotoDosi()
Cartella = "C:UsersVanessaDesktop
icetteRicette"
NomeFile = ActiveCell.FormulaR1C1
ActiveSheet.Hyperlinks.Add Anchor:=Selection, Address:= _
Cartella & NomeFile + ".xlsx", TextToDisplay:=NomeFile
fname = Cartella & NomeFile + ".xlsx"
If Dir(fname) = "" Then
Dim WB As Workbook
Set WB = Workbooks.Open("C:UsersVanessaDesktop
icettewb2.xlsx")
WB.Activate
Application.DisplayAlerts = False
WB.SaveAs Filename:= _
Cartella & NomeFile, FileFormat _
:=xlOpenXMLWorkbook, CreateBackup:=False
Application.DisplayAlerts = True
WB.Close
Else
End If
End Sub
Questo il 2°:
Sub TuttaLaColonna()
Dim rng As Range
Dim cell As Variant
Set rng = Range("A2:A250")
For Each cell In rng
Cartella = "C:UsersVanessaDesktop
icette
icette"
NomeFile = cell
If cell.Value <> "" Then
ActiveSheet.Hyperlinks.Add Anchor:=cell, Address:= _
Cartella & NomeFile + ".xlsx", TextToDisplay:=NomeFile
fname = Cartella & NomeFile + ".xlsx"
If Dir(fname) = "" Then
Dim WB As Workbook
Set WB = Workbooks.Open("C:UsersVanessaDesktop
icettewb2.xlsx")
WB.Activate
Application.DisplayAlerts = False
WB.SaveAs Filename:= _
Cartella & NomeFile, FileFormat _
:=xlOpenXMLWorkbook, CreateBackup:=False
Application.DisplayAlerts = True
WB.Close
Else
End If
End If
Next cell
End Sub
|