编译错误“错误的参数数量或无效的属性赋值”

时间:2017-08-23 00:39:11

标签: excel vba excel-vba compilation basic

我有双重单击单元格时填充单元格的代码。这是:

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)  
    If Not Intersect(Target, Range("C10:C19", "D10:D19", "E10:E19")) Is Nothing Then  
        Cancel = True  
        Target.Formula = Date  
    End If  
End Sub  

代码工作正常,直到我添加"E10:E19"然后它给我一个编译错误说wrong number of arguments or invalid property assignments然后它突出显示第一行代码Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)

完全披露:我是一个完全的菜鸟,所以任何修复或建议请解释,就像我5岁。

1 个答案:

答案 0 :(得分:1)

试试这个

pd.wide_to_long(df, stubnames=['a', 'b', 'c'], i='id', j='dropme', sep='_')\
  .reset_index()\
  .drop('dropme', axis=1)\
  .sort_values('id')

    id  a  b   c
0  101  a  1  aa
2  101  b  2  bb
4  101  c  3  cc
1  102  d  4  dd
3  102  e  5  ee
5  102  f  6  ff

Option Explicit Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean) If Not Intersect(Target, [C10:C19, D10:D19, E10:E19]) Is Nothing Then Cancel = True Target.Formula = Date End If End Sub 范围应该是一个字符串而不是多个字符串
Examnple "C10:C19", "D10:D19", "E10:E19"