首先,我需要通知您,我根本不知道如何编程。我在网上找到了此代码。它正在为我需要做的事情工作,现在它给了我运行时错误1004。
我需要这段代码做的是添加一行并保留前面各行中的方程式。
我不知道如何解决此错误。如前所述,我没有编程背景。我希望我不会因为我不知道自己在做什么而感到沮丧。
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
'Updateby Extendoffice 20160725
Cancel = True
Target.Offset(1).EntireRow.Insert
Target.EntireRow.Copy Target.Offset(1).EntireRow
On Error Resume Next
Target.Offset(1).EntireRow.SpecialCells(xlConstants).ClearContents
End Sub
突出显示的行是:“ Target.EntireRow.Copy Target.Offset(1).EntireRow”
以下是我双击时需要添加到下一行的列中的公式。
从N列到AB列。
Column N
=IF(ISNUMBER(SEARCH("Avox Production",$B$3:$B$3590)),"1","")
Column O
=IF(ISNUMBER(SEARCH("Avox Packaging",$B$207:$B$3590)),"1","")
Column P
=IF(ISNUMBER(SEARCH("Cuvette Production",$B$207:$B$3590)),"1","")
Column Q
=IF(ISNUMBER(SEARCH("Cuvette Packaging",$B$207:$B$3590)),"1","")
Column R
=IF(ISNUMBER(SEARCH("Incision Production",$B$207:$B$3590)),"1","")
Column S
=IF(ISNUMBER(SEARCH("Incision Packaging",$B$207:$B$3590)),"1","")
Column T
=IF(ISNUMBER(SEARCH("Instrument Production",$B$207:$B$3590)),"1","")
Column U
=IF(ISNUMBER(SEARCH("Instrument Packaging",$B$207:$B$3590)),"1","")
Column V
=IF(ISNUMBER(SEARCH("Instrument Service",$B$207:$B$3590)),"1","")
Column W
=IF(ISNUMBER(SEARCH("R & D",$B$207:$B$3590)),"1","")
Column X
=IF(ISNUMBER(SEARCH("Reagent Lab",$B$207:$B$3590)),"1","")
Column Y
=IF(ISNUMBER(SEARCH("Tubes",$B$207:$B$3590)),"1","")
Column Z
=IF(ISNUMBER(SEARCH("Verify Now",$B$3:$B$3590)),"1","")
Column AA
=IF(ISNUMBER(SEARCH("Finished Goods",$B$3:$B$3590)),"1","")
Column AB
=IF(ISNUMBER(SEARCH("Warehouse",$B$3:$B$3590)),"1","")
此代码可以正常运行约5周。我不知道是否有人不小心执行了导致代码无法正常工作的事情。
答案 0 :(得分:0)
我实际上遇到了同样的问题。对我来说,我很确定这是因为我要隐藏一些列,并且代码不喜欢那样。我还使用自定义视图,这可能与它有关。
当我取消隐藏所有列时,代码确实起作用。隐藏某些列时,没有找到没有错误消息的使用方法。