VBA Code to Copy Active Worksheet into new

vishalgw

New Member
Joined
Apr 25, 2014
Messages
1
Hello Everyone,

I am trying to create a VBA Code to copy an active worksheet into a new work sheet. But I am not able to do so, I have tried different syntax for the same but nothing works. Basically, I got a code from google, that works very well with copying a sheet completely, but can't get the activesheet into it. Please help. I am a new born baby as far as VBA is concerned.


<code style="margin: 0px; padding: 0px; border: 0px; vertical-align: baseline; font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, serif; white-space: inherit;">Sub CreateNewSheet()dim sName as stringSheets("24 April").copy after:=activesheetsname=inputbox("Enter new sheet name")on error resume nextactivesheet.name=snameif err<>0 then msgbox "Name not valid"err.clearon error goto 0End Sub</code></pre>
 

Excel Facts

Last used cell?
Press Ctrl+End to move to what Excel thinks is the last used cell.

Forum statistics

Threads
1,216,086
Messages
6,128,736
Members
449,466
Latest member
Peter Juhnke

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top