Johnny Thunder
Well-known Member
- Joined
- Apr 9, 2010
- Messages
- 693
- Office Version
- 2016
- Platform
- MacOS
Hello All,
I am working on a code and trying to insert a named range into the file name reference but I am getting an error "Constant Expression", not sure what I am doing wrong so maybe someone might spot it.
I am working on a code and trying to insert a named range into the file name reference but I am getting an error "Constant Expression", not sure what I am doing wrong so maybe someone might spot it.
Code:
Sub CountFiles()
Dim xFolder As String
Dim xPath As String
Dim xCount As Long
Dim xFiDialog As FileDialog
Dim xFile As String
Dim Year As String
Dim Month As String
Set Year = Sheets("Summary").Range("Cyear").Value
Set Month = Sheets("Lookups2").Range("FolderL").Value
xFolder = "\\Wb\acctg\shared\RPTOHP\FP&A\Budgeting & Forecasting\Monthly Management Reports\Testing\" & Year & "\" & Month & "\"
'Do something
End Sub