Excel Runtime error 1004:: Method 'Range' of Global Failed

Joined
Jun 20, 2017
Messages
1
Reaction score
0
Hi, everyone!

I'm new user of VBA and I have a problems with a code that I wrote:

Sub Main()

Const strRootFolder As String = "M:\Production\Masters\2017\Normalization"

Dim strFolder As String

strFolder = "M:\Production\Masters\2017\Normalization\" & Range("sheet_name").Value

If Dir(strFolder, vbDirectory) = "" Then
MkDir strFolder
End If

Dim New_Wb As Workbook
Set New_Wb = Workbooks.Add
New_Wb.Activate
New_Wb.SaveAs ("M:\Production\Masters\2017\Normalization\" & Range("sheet_name").Value & "\" & Range("Book"))


Windows("Normalization counting.xlsm").Activate

End Sub

Th error debugs to the line
New_Wb.SaveAs ("M:\Production\Masters\2017\Normalization\" & Range("sheet_name").Value & "\" & Range("Book"))

Please, I really need your help!

P.S. sorry for mistakes I may have. I'm not native speaker:blush:
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top