Run Time Error '1004': Select method of Range Class failed VBA 2003

后端 未结 3 1846
抹茶落季
抹茶落季 2021-01-22 19:55

I am trying to copy a column from one sheet to another. The code I am using is a recorded macro and it works fine until I connect it to a button. When I do so, it gives a

3条回答
  •  梦毁少年i
    2021-01-22 20:19

    You should always avoid using .Select They are a major cause of errors. You may want to see How to avoid using Select in Excel VBA

    Sub Sample()
        Sheets("Count").Columns("C:C").Copy _
        Sheets("Add Invintory").Columns("B:B")
    
        Sheets("Count").Columns("A:A").Copy _
        Sheets("Add Invintory").Columns("A:A")
    End Sub
    

提交回复
热议问题