Hi guys I have this bunch of code:
For Each ws In ThisWorkbook.Sheets
If ws.Name = "Position calculation" Or ws.Name = "Strategies & weights" Then
Else
sheet_name = ws.Name
Sheets(sheet_name).Visible = True
ThisWorkbook.Worksheets(sheet_name).Activate
ws.Range("A2").Select
For Each c In Range("A2", "A1000")
If c.Value = "" Then
c.Activate
searched_cell = ActiveCell.Offset(-1, 0).Address
GoTo flag1
End If
Next c
Everytime when I try to run a code from a sheet called "Position calculation" I get the error saying
Run - time error '1004' Activate method of Worksheet class failed
I cannot distinguish why the code is running from other sheets, but I have to run this script exactly from the page causing me this sort of error.
Thank you in advance for your help