Я пытаюсь обновить прайс-лист из одной рабочей книги в другую, за исключением того, что я не хочу отправлять Заказчику макросы из Основного прайс-листа ...
Мастер в конечном итоге будет иметь одну вкладку для каждого продавца.
Мастер-копия будет отправлена клиенту без макросов.
Вот мой код на данный момент ..
Я получаю сообщение об ошибке 1004 Метод вставки не удался
'Now copy from the Update Master to the Cust Master...
mWrk = "A1:Z" & Trim(Str(TotRows)) <---TotRows is the total # of rows used
Application.CutCopyMode = XLCopy
Worksheets(WhichFile).Range(mWrk).Copy <-- WhichFile has the value of the sheet name..
Dim mXLCopy As Workbook
Set mXLCopy = Workbooks.Open(ThisWorkbook.Path & "\Customer Master Price.xlsx")
' See if the sheet is already there. if so delete it.
Dim IsThere As Boolean
IsThere = False
For x = 1 To mXLCopy.Sheets.Count
If UCase(mXLCopy.Sheets(x).Name) = UCase(WhichFile) Then
IsThere = True
End If
Next x
Application.DisplayAlerts = False
If IsThere Then
mXLCopy.Sheets(WhichFile).Delete
End If
'
'Now add it & activate it..
mXLCopy.Sheets.Add().Name = WhichFile
mXLCopy.Activate
With mXLCopy.Sheets(WhichFile)
Range(mWrk).PasteSpecial xlPasteAll, xlPasteSpecialOperationNone <- Fails here
End With
Application.DisplayAlerts = True
mXLCopy.Save
mXLCopy.Close
Set mRange = Nothing
Set mXLCopy = Nothing
Есть идеи у кого-нибудь? Иди вперед и посмеяться надо мной, если нужно, но мне нужен ответ, и никто из меня не работает ...