在另一台PC上运行时,自动填充上的Excel VBA Runtime 1004错误

汤姆·G

我真的可以在这里使用知识之泉!

我有一个VBA封装的电子表格,我要它在可变范围内自动填充公式。它可以在我的PC上完美运行,但对同事却不起作用。

错误是:运行时错误1004

代码是:

Sub FillFormula()    

Dim BOBdate As Date 
Dim Bobrow, lastrow As Integer

lastrow = ActiveCell.CurrentRegion.Rows.Count + 2

BOBdate = Sheets("BOB Pivot").Range("a3").Value

Cells.Find(What:=BOBdate, After:=ActiveCell, LookIn:=xlFormulas, _
    LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
    MatchCase:=False, SearchFormat:=False).Activate

    ActiveCell.Offset(0, 5).Select
    ActiveCell.FormulaR1C1 = _
    "=iferror(INDEX('BOB Pivot'!R2C1:R50000C50,MATCH('Rooms Daily'!RC2,'BOB Pivot'!R2C1:R50000C1,0),MATCH('Rooms Daily'!R3C,'BOB Pivot'!R2C1:R2C50,0)),0)"

BOBrow = ActiveCell.Row

With ActiveCell
    .AutoFill Destination:=Range("G" & BOBrow & ":AJ" & BOBrow), Type:=xlFillDefault
    .AutoFill Destination:=Range("G" & BOBrow & ":AJ" & LastRow), Type:=xlFillDefault
    .AutoFill Destination:=Range("G" & BOBrow & ":G" & LastRow), Type:=xlFillDefault

End With

End Sub

不上传整个工作簿,有什么明显的事情吗?

我是vba的菜鸟,所以如果编码太糟糕了,请保持内在的咯咯笑声!

谢谢

汤姆

汤姆·G

解决了...修改了自动填充的传播方式

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章

Excel VBA运行时错误1004

错误1004:Excel VBA

VBA - 运行时错误“1004”

excel vba 错误 1004 范围

一台PC上的类型不匹配,但另一台计算机上的类型不匹配-运行时错误13

Excel VBA 运行时错误 1004 - ThisWorkbook.Connections

Excel VBA-运行时错误1004

Excel VBA宏出现运行时错误'1004'

Excel VBA Vlookup运行时错误1004

Excel VBA查找函数获取运行时错误1004

尝试插入公式时VBA运行时错误'1004'

在列中选择数据的VBA运行时错误1004

如何修复VBA运行时错误1004或424

VBA 运行时错误 1004:范围(“ ”)。公式

VBA 中的 IF 条件公式 - 运行时错误“1004”

Excel-VBA-公式错误1004-

Excel VBA-表列公式-错误1004

EXCEL VBA , 搜索行错误 1004

Excel VBA中的自动填充返回错误1004

VBA Excel。运行时错误'1004'。应用程序定义或操作定义的错误

Excel VBA运行时错误1004“应用程序定义或对象定义的错误”

在一台机器上访问数据库运行时错误 3340,但在另一台机器上没有

复制行时VBA-Excel中的运行时错误1004

VBA:如何自动无错误地包含单元格边框(运行时 1004)线型

Excel VBA:运行时错误1004:Excel无法访问文件

运行时错误'1004':应用程序定义的错误或对象定义的错误VBA

范围的VBA运行时错误1004“应用程序定义的错误或对象定义的错误”

VBA 运行时错误“1004”在一个完美运行的例程中

使用Excel VBA在工作簿中查找匹配项:运行时错误1004