我收到一個運行時錯誤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