create dynamic vba script for new sheets for each row from main sheet with name

ganu learner

New Member
Joined
Dec 31, 2019
Messages
47
Office Version
  1. 2013
Platform
  1. Windows
res sir I record a micro for 3 new sheets create from main sheet is below.

now I want new sheets create dynamically acording to main sheet. in which row 1:1 is header so in every sheet first row is common after that new sheet for every row according to main sheet and also with name according column A .

recorded micro is below here thanks

Sub Macro1()
Range("A1").Select
Sheets.Add After:=ActiveSheet
Sheets("NiftyBank MW").Select
Rows("1:1").Select
Selection.Copy
Sheets("Sheet1").Select
Rows("1:1").Select
ActiveSheet.Paste
Sheets("NiftyBank MW").Select
Sheets("NiftyBank MW").Name = "NiftyBank MW"
Rows("2:2").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Sheet1").Select
Sheets("Sheet1").Name = "Sheet1"
Rows("2:2").Select
ActiveSheet.Paste
Sheets.Add After:=ActiveSheet
Sheets("NiftyBank MW").Select
Sheets("NiftyBank MW").Name = "NiftyBank MW"
Rows("1:1").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Sheet2").Select
Rows("1:1").Select
ActiveSheet.Paste
ActiveSheet.Paste
Sheets("NiftyBank MW").Select
Rows("3:3").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Sheet2").Select
Rows("2:2").Select
ActiveSheet.Paste
Sheets.Add After:=ActiveSheet
Sheets("Sheet3").Name = "Sheet3"
Sheets("NiftyBank MW").Select
Rows("1:1").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Sheet3").Select
Rows("1:1").Select
ActiveSheet.Paste
Sheets("NiftyBank MW").Select
Rows("4:4").Select
Application.CutCopyMode = False
Selection.Copy
Application.CutCopyMode = False
Selection.Copy
Sheets("Sheet3").Select
Rows("2:2").Select
ActiveSheet.Paste
Sheets("NiftyBank MW").Select
Range("A1").Select
End Sub

 

Excel Facts

Using Function Arguments with nested formulas
If writing INDEX in Func. Arguments, type MATCH(. Use the mouse to click inside MATCH in the formula bar. Dialog switches to MATCH.
What exactly do you mean by "if new sheet is created then script skip at that time "
 
Upvote 0
What exactly do you mean by "if new sheet is created then script skip at that time "
Sir means that
Suppose my main sheet have 10 rows
now I paste VBA script in it .
After pasting VBA script my main sheet created new sheets according to my main sheet .
After created new sheets my task is complete .
 
Upvote 0
In that case just put the code into a Workbook_Open event in the ThisWorkbook module
 
Upvote 0

Forum statistics

Threads
1,214,979
Messages
6,122,551
Members
449,088
Latest member
davidcom

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