Consulting

Results 1 to 3 of 3

Thread: ADDING A SHEET USING VBA BUT GETTING ERROR

  1. #1
    VBAX Regular
    Joined
    Jun 2019
    Posts
    50
    Location

    ADDING A SHEET USING VBA BUT GETTING ERROR

    Hello,
    So I have option explicit on the top of my code and I am trying to add a worksheet into my workbook using VBA. However, I want my syntax to add the worksheet to the right side of the existing worksheets, not before them. How do I do that without getting a syntax error or "missing = expression" error?

    I tried this and it did not work:
    ActiveWorkbook.Sheets.Add(False, True)

    Thanks in advance!

  2. #2
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
        With ActiveWorkbook
        
            .Worksheets.Add After:=.Worksheets(.Worksheets.Count)
        End With
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  3. #3
    VBAX Regular
    Joined
    Jun 2019
    Posts
    50
    Location
    thank you!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •