我收到一个运行时错误91.我知道这通常是从没有正确设置范围,但我只在这种情况下引用工作表。为什么我得到这个错误?该代码应该创建一个新列并将其命名为“公司名称”。Excel 2007 VBA运行时错误'91'与For Each循环
Dim ws As Worksheet
For Each ws In Sheets
If ws.Name Like "*Sheet*" Then ws.Rows(1).Find("customer_name",LookAt:=xlPart).EntireColumn.Select
Application.CutCopyMode = False
Selection.Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove
ws.Rows(1).Find("customer_name", LookAt:=xlPart).Offset(0, -1).Select >----error here
ActiveCell.Value = "company name"
Next