如何修复应用程序定义或对象定义的错误

时间:2017-02-24 17:06:35

标签: vba

这个宏在我的计算机上适用于我,但当我让我的同事运行它时,它让我很头疼。

有关为什么这会给我带来麻烦的任何建议?

宏在我的计算机上工作正常,但在我的同事的计算机上,运行时错误' 1004'弹出...应用程序定义或对象定义的错误。调试将我带到脚本的底部,就在下面“调整摘要页面上每个部分的大小。”

谢谢!

Sub Resize_Template()

'count records on pipeline tab
Dim pipe As Integer
With Sheets("Pipeline - Underwriting Data D")
pipe = .Range("A" & .Rows.Count).End(xlUp).Row - 1
End With
'count records on Lead tab
Dim Lead As Integer
With Sheets("Lead Data")
Lead = .Range("A" & .Rows.Count).End(xlUp).Row - 1
End With
'count records on approved tab
Dim App As Integer
With Sheets("Approved Closing Data Draw")
App = .Range("A" & .Rows.Count).End(xlUp).Row - 1
End With
'count records on mods tab
Dim Mods As Integer
With Sheets("Modifications")
Mods = .Range("A" & .Rows.Count).End(xlUp).Row - 1
End With
'resize each section on the summary page
Sheets("Weekly Pipeline Template").Range("App_Close_btm").Resize(App - 2).EntireRow.Insert
Sheets("Weekly Pipeline Template").Range("Modifications_btm").Resize(Mods - 2).EntireRow.Insert
Sheets("Weekly Pipeline Template").Range("UW_btm").Resize(pipe - 2).EntireRow.Insert
'Lead section does not need to be resized at this time
End Sub

0 个答案:

没有答案