0

I'm looking for a vba macro that copy whole data inside a sheet to another creating the new sheet. For example; I have a sheet called 14.11.2013 with some values.. clicking a button i need that the macro creates the new sheet and copy the entire datas from 14.11.2013 sheet to this one new. I'm a beginner in vba so i don't have much idea how can i do this kind of work. Someone can help me?

Of course when everything is copyed i want redirect in the new sheet.. I think something like:

Sheets("NewSheet").Activate
pnuts
  • 58,317
  • 11
  • 87
  • 139
David_D
  • 1,404
  • 4
  • 31
  • 65
  • 5
    You can try to record a macro and see how to do this. – Makah Nov 14 '13 at 16:18
  • 2
    http://stackoverflow.com/questions/19584497/how-to-replicate-a-sheet-using-vba-macro-not-copy-replicate – Siddharth Rout Nov 14 '13 at 16:19
  • you mean record the procedure "creation of new sheet, copy and paste the datas" in meanwhile i do it and then execute it wherever i want? – David_D Nov 14 '13 at 16:20
  • Yes. After you record the macro, and view the code, you'll get a good idea of what you need to do to execute the process via vba. – Jaycal Nov 14 '13 at 16:27

2 Answers2

1

Here is the general format:

Sub CopySheet()
    Dim s As Worksheet
    Set s = Sheets("14.11.2013")
    s.Copy after:=s
End Sub
Gary's Student
  • 95,722
  • 10
  • 59
  • 99
-1

If you are looking for some beginner tutorials i would recommend ExcelVBAIsFun on youtube.

I believe this video will help with how to record macros and teach yourself how to do some of the more simple things in Excel VBA. It also does something very similar to copying from one sheet to the other. http://www.youtube.com/watch?v=HmAYKyurYNU&list=PLw8O1w0Hv2ztGjIkrW7suD6oNDaOk3vbR

I used this quite a bit while learning VBA myself.

Tylor Hess
  • 639
  • 5
  • 15