Solved

new sheet adds number from last sheet

Posted on 2011-02-24
7
278 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
Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 

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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Web Query 1 21
Response times in Excel 18 44
Turn date into age 17 33
Conditional formatting of a cell based on text anywhere in the workbook 4 64
Over the years I have built up my own little library of code snippets that I refer to when programming or writing a script.  Many of these have come from the web or adaptations from snippets I find on the Web.  Periodically I add to them when I come…
When you see single cell contains number and text, and you have to get any date out of it seems like cracking our heads.
The viewer will learn how to use the =DISCRINV command to create a discrete random variable, use this command to model a set of probabilities and outcomes in a Monte Carlo simulation, and learn how to find the standard deviation of a set of probabil…
This Micro Tutorial will demonstrate on a Mac how to change the sort order for chart legend values and decrpyt the intimidating chart menu.

860 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