Consulting

Results 1 to 3 of 3

Thread: How can I use a current worksheet rather than creating a new one?

  1. #1

    How can I use a current worksheet rather than creating a new one?

    Hi, sorry I think this is a really simple problem but I can't seem to get it to work.

    I currently have a macro which will create a new worksheet for me to paste data to. How can I adjust this so that instead of adding a worksheet, it goes to a worksheet already present? (named for example: Pastesheet)

        Set wsTarget = Worksheets.Add
        On Error Resume Next
        wsTarget.Name = "WebData"
        On Error GoTo 0
    So this current macro will create a sheet named WebData. But how would I set the wsTarget to a sheet already present?

    Apologies, I didn't create this macro so I have no idea how it works yet.

  2. #2
    VBAX Master Aflatoon's Avatar
    Joined
    Sep 2009
    Location
    UK
    Posts
    1,720
    Location
    Set wsTarget = activeworkbook.worksheets("Pastesheet")
    for example. Change the workbook and/or sheet name to suit.
    Be as you wish to seem

  3. #3
    Damn I knew it was something like that, I was trying to just write ("Pastesheet")

    Many thanks for clarification!

Tags for this Thread

Posting Permissions

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