PDA

View Full Version : [SOLVED] How can I use a current worksheet rather than creating a new one?



roxnoxsox
01-13-2016, 04:22 AM
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.

Aflatoon
01-13-2016, 04:33 AM
Set wsTarget = activeworkbook.worksheets("Pastesheet")
for example. Change the workbook and/or sheet name to suit.

roxnoxsox
01-13-2016, 04:34 AM
Damn I knew it was something like that, I was trying to just write ("Pastesheet")

Many thanks for clarification!