I have a workbook with several sheets. The first sheet is a form with dropdowns, data validation and formulas in it that is used to populate the second sheet. This data changes everyday. I have macros that perform functions that I need running from a macro button on Sheet1.The information on it is compiled (added to) the second sheet (thru macros)and the workbook is copied and saved to the same location everytime (overwritten). My problem is when I open the workbook each day to enter data into Sheet1, it still has the data from the previous day on it. I need a "fresh" sheet with formulas, macros ect...to enter the data on ....perform the macros and continue the process over and over. In other words I need to overwrite the workbook each time I save it ( to keep compiling all of the info on Sheet2) EXCEPT for Sheet1. I need Sheet1 to be a fresh sheet every time I open the workbook. Any ideas on this?
Have added Sheet1 as the example. Thanks
Last edited by kwik98; 06-10-2010 at 09:35 AM. Reason: Adding Sheet1 example
You would do best to post a sample workbook showing Before and After.(Sheet 1 should be enough)
The task you wish to perform could be done in either the workbook "Before Close" or "Open" event,
but we would need to know, what your Sheet1 needs to retain.
Another option is to store a template with the workbook, copy it to work with, then delete the copy when you are done.
The sample should clearly illustrate your problem and not contain any sensitive data.
Cheers
Remember, I have to keep adding to the data on Sheet2 each day. I cant open the workbook as new and save or I lose all of the compiled data. If there is a way of opening the saved workbook, with Sheet1 being the only fresh sheet, the rest is compiled data, that would be the answer. There are several other sheets that need to work off of the Sheet2 database.
Also, I cant keep saving copies of the WB in the folder. Each copy of the Wb I have openvhas to replace the WB in the folder .
I might have found an answer to my own problem previously posted but I cant get the code changed right.
This code takes data on a form and moves it to a different sheet in the workbook in the order I need it to. There are three more macros similar to this one that I use also but if I get it to work on this one I can make it work on the others I am pretty sure. The change I need i this code is....instead of moving the data into a different sheet within this workbook, I need it to populate the same cells on a sheet (named the same) only in a DIFFERENT workbook.
I"ve tried changing the =Worksheets("Timesheets") to the appropraite folder loc but it doesnt seem to work. Is there a simple fix here?
Sub UpdateLogWorksheet() Dim historyWks As Worksheet Dim inputWks As Worksheet Dim nextRow As Long Dim oCol As Long Dim myRng As Range Dim myCopy As String Dim myCell As Range myCopy = "H11,A61,A12,B61,B7,H9,B61,C61,D61,H12,E61,F61,G61,H13,H61,I61,J61,A49,A50,A51,A52,A53,A54,A55,A56,A57,A58,H49,H50,H51,H52,H53,H54,H55,H56,H57,H58" Set inputWks = Worksheets("Timesheet") Set historyWks = Worksheets("WorkCompCore") With historyWks nextRow = .Cells(.Rows.Count, "A").End(xlUp).Offset(1, 0).Row End With With inputWks Set myRng = .Range(myCopy) End With With historyWks oCol = 1 For Each myCell In myRng.Cells historyWks.Cells(nextRow, oCol).Value = myCell.Value oCol = oCol + 1 Next myCell End With 'clear input cells that contain constants With inputWks On Error Resume Next On Error GoTo 0 End With End Sub
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks