Error In VBA Excel

Ashkan Azadikhah 0 Reputation points
2023-09-15T07:35:23.14+00:00
Hello
It gives an error when executing the following commands except for the last sheet. where is the problem from?

   Dim SheetNum, ProjectNum As Integer
    For SheetNum = Sheets.Count To 1 Step -1
      With Sheets(SheetNum)
        Co = WorksheetFunction.Match(ProjectNum,.Rows(1))
        .Activate
        .Range(Columns(Co - 3), Columns(Co)).Delete
      End With
    Next Sh
Microsoft 365
Microsoft 365
Formerly Office 365, is a line of subscription services offered by Microsoft which adds to and includes the Microsoft Office product line.
4,737 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Olaf Helper 44,296 Reputation points
    2023-09-15T07:59:02.4133333+00:00

    where is the problem from?

    The question is more, which detailed error message do you get, in whcih line and what is "WorksheetFunction.Match(ProjectNum,.Rows(1))"

    You have to provide more details.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.