dpaton05
Well-known Member
- Joined
- Aug 14, 2018
- Messages
- 2,352
- Office Version
- 365
- 2016
- Platform
- Windows
I have code that adds a name to a list and I am trying to write code to create a workbook and call it by the name that was added to the list.
This is what I have so far but this code just highlights the word Filename and says named argument not found.
What is wrong with my code?
This is what I have so far but this code just highlights the word Filename and says named argument not found.
What is wrong with my code?
VBA Code:
Sub AddYP()
Dim NewYP As String
NewYP = Tracker.Cells(5, 4)
YP.Range("A" & Rows.Count).End(xlUp).Offset(1, 0) = NewYP
Call CreateWB(NewYP)
End Sub
Sub CreateWB(NewYP As String)
Dim wb1 As Workbook
Workbooks.Add Filename:=NewYP
'wb1.Name = NewYP & ".xlsm"
End Sub