Forum

automation error fo...
 
Notifications
Clear all

automation error for worksheets selection

2 Posts
1 Users
0 Reactions
134 Views
(@julian)
Posts: 82
Estimable Member
Topic starter
 

I've a script to copy a formula from cell A15 of worksheet "Onepage" and past it onto a specific cell of the rest workseets starting sheet #4. It has been running smoothly for qute a long time. However, after making some chanages to my workbook last weekend without touching VBA at all, an automation error as highlighted below in red color came to me. May I know what's the problem and how to solve it? Many thnaks.

 

Sub UpdatePrice1()

Dim WS_Count As Integer
Dim I As Integer
Dim pos As Long

Application.ScreenUpdating = False

Sheets("Onepage").Select

pos = Date - 44560

Range("A15").Select

Selection.Copy

WS_Count = ActiveWorkbook.Worksheets.Count

For I = 4 To WS_Count

Worksheets(I).Select

Range("B" & pos).Select
ActiveSheet.Paste
Next I
Sheets("Onepage").Select
Application.CutCopyMode = False

Application.ScreenUpdating = True

MsgBox "Prices updating..."

End Sub

 
Posted : 31/05/2022 6:48 am
(@julian)
Posts: 82
Estimable Member
Topic starter
 

It's my pleasure to report here I've fixed the automation error happened to me. The reason for that error is the sheet code name "Sheet3" was not in place after I added "on error resume next" statement then I found it's missing among 16 worksheets. 

 
Posted : 31/05/2022 11:11 pm
Share: