Need to create sheet in work book after every 2 miniutes

amittheexcel

Board Regular
Joined
Dec 17, 2013
Messages
50
Hi There,

I need to create excel tab after every 2 minutes as per sheet1 in workbook and rename them as per SR.no provided in sheet1 like below.

[TABLE="width: 64"]
<colgroup><col width="64" style="width:48pt"> </colgroup><tbody>[TR]
[TD="class: xl65, width: 64"][/TD]
[TD="class: xl65, width: 64"]SR.NO[/TD]
[/TR]
[TR]
[TD="class: xl65, align: right"][/TD]
[TD="class: xl65, align: right"]1[/TD]
[/TR]
[TR]
[TD="class: xl65, align: right"][/TD]
[TD="class: xl65, align: right"]2[/TD]
[/TR]
[TR]
[TD="class: xl65, align: right"][/TD]
[TD="class: xl65, align: right"]3[/TD]
[/TR]
[TR]
[TD="class: xl65, align: right"][/TD]
[TD="class: xl65, align: right"]4[/TD]
[/TR]
[TR]
[TD="class: xl65, align: right"][/TD]
[TD="class: xl65, align: right"]5[/TD]
[/TR]
[TR]
[TD="class: xl65, align: right"][/TD]
[TD="class: xl65, align: right"]6[/TD]
[/TR]
[TR]
[TD="class: xl65, align: right"][/TD]
[TD="class: xl65, align: right"]7[/TD]
[/TR]
[TR]
[TD="class: xl65, align: right"][/TD]
[TD="class: xl65, align: right"]8[/TD]
[/TR]
[TR]
[TD="class: xl65, align: right"][/TD]
[TD="class: xl65, align: right"]9[/TD]
[/TR]
[TR]
[TD="class: xl65, align: right"][/TD]
[TD="class: xl65, align: right"]10[/TD]
[/TR]
[TR]
[TD="class: xl65, align: right"][/TD]
[TD="class: xl65, align: right"]11[/TD]
[/TR]
[TR]
[TD="class: xl65, align: right"][/TD]
[TD="class: xl65, align: right"]12[/TD]
[/TR]
[TR]
[TD="class: xl65, align: right"][/TD]
[TD="class: xl65, align: right"]13[/TD]
[/TR]
[TR]
[TD="class: xl65, align: right"][/TD]
[TD="class: xl65, align: right"]14[/TD]
[/TR]
</tbody>[/TABLE]
Regards,
Amit
 

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.
With YOur Sheet NAMED -->> MAIN as follows: There should not be ANY OTHER SHEETS IN THE Workbook, only this one - MAIN

Opps -- Sorry After posting I just realized I forgot about the "Every 2 Minutes part" -- I'll get back to you later (on that revision).

Jim

Excel 2010
A
SR.NO

<tbody>
[TD="align: center"]1[/TD]

[TD="align: center"]2[/TD]
[TD="align: right"]1[/TD]

[TD="align: center"]3[/TD]
[TD="align: right"]2[/TD]

[TD="align: center"]4[/TD]
[TD="align: right"]3[/TD]

[TD="align: center"]5[/TD]
[TD="align: right"]4[/TD]

[TD="align: center"]6[/TD]
[TD="align: right"]5[/TD]

[TD="align: center"]7[/TD]
[TD="align: right"]6[/TD]

[TD="align: center"]8[/TD]
[TD="align: right"]7[/TD]

[TD="align: center"]9[/TD]
[TD="align: right"]8[/TD]

[TD="align: center"]10[/TD]
[TD="align: right"]9[/TD]

[TD="align: center"]11[/TD]
[TD="align: right"]10[/TD]

[TD="align: center"]12[/TD]
[TD="align: right"]11[/TD]

[TD="align: center"]13[/TD]
[TD="align: right"]12[/TD]

[TD="align: center"]14[/TD]
[TD="align: right"]13[/TD]

[TD="align: center"]15[/TD]
[TD="align: right"]14[/TD]

</tbody>
Main
Copy this Macro into a Standard Module. And then run Macro.

Code:
Sub CreateWorksheets()
Dim CurrSht As Worksheet
Range("A2").Select
i = 2
Application.ScreenUpdating = False
Do Until ActiveCell = ""
    Set CurrSht = Worksheets.Add(After:=Worksheets(Worksheets.Count))
    ActiveSheet.Name = "SR.NO " & Worksheets("Main").Cells(i, 1)
    Worksheets("Main").Activate
    ActiveCell.Offset(1).Select
    i = i + 1
Loop
Application.ScreenUpdating = True
End Sub
 
Last edited:
Upvote 0
Here's the Line which should be inserted AFTER the existing line i = i + 1 and Before the line Loop.

Application.Wait Now + TimeValue("00:02:00")

ALSO, you might want to comment out (Using the " ' " (apostrophe)) the 2 lines dealing with Screenupdating -- "SO YOU CAN SEE THE PROGRESS BEING MADE".

Not 100% positive, but that should work.. We'll See LOL,,,,

Jim
 
Last edited:
Upvote 0
To test this
- create a NEW workbook with ONLY one sheet (Sheet1)
- place typical values in Sheet1

Put this in a STANDARD module and run the macro
Code:
Sub CreateSheet()
    Sheets("Sheet1").Copy After:=Sheets(Sheets.Count)
    Sheets(Sheets.Count).Name = Sheets.Count - 1
    Application.OnTime Now + TimeValue("00:02:00"), "CreateSheet"
End Sub
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,175
Members
453,021
Latest member
Justyna P

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