Code for copying master worksheet that has refreshable data

mozzie789

New Member
Joined
May 19, 2008
Messages
17
Hi there

I have a worksheet that has data that changes when refreshed approx every minute. I've searched the forum and found a lot of examples of copying s'sheets within a workbook for "static" data - but can't find any code or examples of copying a s'sheet to another s'sheet within the workbook where the master s'sheet has refreshable data.

Can someone point me to a searchable term or thread within the forum that does the above?

In summary, I just want to keep the master ("master") sheet as is, but copy it to another s'sheet ("duplicate") within the workbook so that this new s'sheet "duplicate" has the refreshable data and in effect is exactly the same as the "master".

I'm doing this so I can run some formulas over the "duplicate" sheet and leave the "master" sheet untouched.
 

Excel Facts

Which came first: VisiCalc or Lotus 1-2-3?
Dan Bricklin and Bob Frankston debuted VisiCalc in 1979 as a Visible Calculator. Lotus 1-2-3 debuted in the early 1980's, from Mitch Kapor.
This code will clear worksheet "Sheet2", then copy "Sheet1" data to it.
Code:
Sub TestClearAndCopy()
'Assign variable names to Source and Destination Worksheets
    ss = "Sheet1"
    ds = "Sheet22"
'Clear old data from Destination sheet
    Sheets(ds).Cells.Clear
'Copy Source Sheet to Destination Sheet
    Sheets(ss).Cells.Copy Destination:=Sheets(ds).Range("A1")
End Sub
Change the sheet names in the code as needed.

As far as running "some formulas over the "duplicate" sheet", I would suggest using Advanced Filtering.
Good example of Advanced Filter steps here:
http://www.contextures.com/xladvfilter01.html

AdvancedFilter Video Demo here:
http://www.contextures.com/xlVideos04.html

Another good link with sample VBA code here:
http://www.meadinkent.co.uk/xlfilter.htm

Advanced Filter allows you to preset filter options.
It also allows you to filter by criteria in ways standard autofilter can not do. You can choose an export location in the dialog box or in VBA code.
Once you setup the code and criteria, you can use a macro button to copy specific data from your main sheet to a "Report" sheet. The original data remains unchanged and the data "Filtered" to another page can be used as desired.
 
Upvote 0
Thanks Datsmart, great links and info.

I most surely am sticking to the original thread and info contained in it VoG. Your help in that thread was most valued and it is the code that you supplied that I will be applying (along with my more simplistic formulas) to the duplicate sheet.

Thanks again for everyone's help.
 
Upvote 0

Forum statistics

Threads
1,224,559
Messages
6,179,517
Members
452,921
Latest member
BBQKING

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