Solved

new sheet adds number from last sheet

Posted on 2011-02-24
7
283 Views
Last Modified: 2012-06-27
i need a code the creates a new sheet but the copies the numbers from the last sheet i created..
0
Comment
Question by:joshuajoseph09
7 Comments
 
LVL 6

Expert Comment

by:FernandoFernandes
ID: 34974136
why dont you right click on the sheet tab and select create a copy ?
0
 
LVL 65

Expert Comment

by:RobSampson
ID: 34974346
Hi, what "numbers" are you talking about?  Incrementing the sheet name, or copying data on the sheet?

Rob.
0
 
LVL 30

Expert Comment

by:SiddharthRout
ID: 34974549
joshuajoseph09: A sample sheet of Before and After scenario will help for a speedy solution :)

Sid
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:joshuajoseph09
ID: 34975803
i have a button that creates a new sheet, with todays date. i need a code to copy over a row of numbers from the old sheet and put them into the new
0
 
LVL 65

Expert Comment

by:RobSampson
ID: 34975864
So is the old sheet just the sheet immediately before the current one?

Something like this might work:

dteToday = InputBox("Enter todays date:")
ActiveWorkbook.Sheets.Add , ActiveWorkbook.Sheets(ActiveWorkbook.Sheets.Count)
Set objNewSheet = ActiveWorkbook.Sheets(ActiveWorkbook.Sheets.Count)
objNewSheet.Name = dteToday
Set objPreviousSheet = ActiveWorkbook.Sheets(ActiveWorkbook.Sheets.Count - 1)
objPreviousSheet.Range("A1:Z1").Copy objNewSheet.Range("A1")


Regards,

Rob.
0
 

Author Comment

by:joshuajoseph09
ID: 34976698
i need it more like this. it needs to copy only the active sheet and make a new sheet and copy over the old data
dteToday = InputBox("Enter todays date:")
ActiveSheet.Select.Copy , ActiveSheet(ActiveSheet.Count)
Set objNewSheet = ActiveSheets(ActiveSheet.Count)
objNewSheet.Name = dteToday
Set objPreviousSheets = ActiveSheet(ActiveSheet.Count - 1)
objPreviousSheets.Range("F11:F16,H11:H16,J11:J16,L11:L16,N11:N16,P11:P16,R11:R16").Copy objNewSheet.Range("AA11:AG16")

Open in new window

0
 
LVL 65

Accepted Solution

by:
RobSampson earned 500 total points
ID: 34976738
I haven't tested it, but try this.

Regards,

Rob.
dteToday = InputBox("Enter todays date:")
Set objPreviousSheet = ActiveSheet
objPreviousSheet.Copy , ActiveWorkbook.Sheets(ActiveWorkbook.Sheets.Count)
Set objNewSheet = ActiveWorkbook.Sheets(ActiveWorkbook.Sheets.Count)
objNewSheet.Name = dteToday
objPreviousSheet.Range("F11:F16,H11:H16,J11:J16,L11:L16,N11:N16,P11:P16,R11:R16").Copy objNewSheet.Range("AA11:AG16")

Open in new window

0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article descibes how to create a connection between Excel and SAP and how to move data from Excel to SAP or the other way around.
Freeze panes is an option within all variants of Excel to enable parts of a sheet to remain stationary when the cursor is in another part of the sheet. This is a very useful feature which is overlooked or under used.
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa‚Ķ

679 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question