Smartgambler
Pro-Punter

Go Back   OZmium Sports Betting and Horse Racing Forums > Public Forums > General Topics
User Name
Password
Register FAQ Search Today's Posts Mark all topics as read

To advertise on these
forums, e-mail us.

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 17th June 2013, 06:22 PM
Dennis G Dennis G is offline
Member
 
Join Date: Mar 2006
Posts: 112
Default Another Excel Question

To the Excel Exspurts,
I'm looking to write a macro to transfer a bank of cells with formulae from a master WS '_TABLES.xlsm' to the current WS. Where the current WS can be named anywhere between '12-01-01.xlsm' to '12-12-31.xlms'.

I suppose I'm looking for a generic label to call to the CURRENT Ws whichever that may be.

Any one got any ideas?
Thanks,
Dennis
Reply With Quote
  #2  
Old 18th June 2013, 06:50 AM
Chrome Prince Chrome Prince is offline
Member
 
Join Date: Jan 1970
Posts: 4,425
Default

Dennis,

Sub Test1()
On Error Resume Next
Sheets(ActiveSheet.Index + 1).Activate
If err.number <> 0 Then Sheets(1).Activate
End Sub

This will move to the next sheet without the need for incorporating the name in the macro. It has error checking to prevent runtime errors when it gets to the last sheet in the workbook.
__________________
RaceCensus - powerful system testing software.
Now with over 409,000 Metropolitan, Provincial and Country races!
http://www.propun.com.au/horse_raci...ng_systems.html
*RaceCensus now updated to 31/10/2024
Video overview of RaceCensus here:
http://www.youtube.com/watch?v=W821YP_b0Pg
Reply With Quote
  #3  
Old 19th June 2013, 04:17 PM
Dennis G Dennis G is offline
Member
 
Join Date: Mar 2006
Posts: 112
Default

Thanks Mate,
but this is doing my head in...
I need to add another macro to each WB anyway so it's just as easy to do the washing by hand....

Den
Reply With Quote
  #4  
Old 19th June 2013, 06:47 PM
Chrome Prince Chrome Prince is offline
Member
 
Join Date: Jan 1970
Posts: 4,425
Default

Sorry Den, I thought it was worksheets within one workbook, not various workbooks. My mistake.
__________________
RaceCensus - powerful system testing software.
Now with over 409,000 Metropolitan, Provincial and Country races!
http://www.propun.com.au/horse_raci...ng_systems.html
*RaceCensus now updated to 31/10/2024
Video overview of RaceCensus here:
http://www.youtube.com/watch?v=W821YP_b0Pg
Reply With Quote
  #5  
Old 3rd July 2013, 06:55 AM
Puntz Puntz is offline
Member
 
Join Date: Jan 2012
Posts: 292
Default

Ok,
this is a start, but can be tweaked as required

What you need to test this is 2 Workbooks
Name the 1stWBk;
MASTER_WORKBOOK.xlsm
and place the macro code shown below in that WB

Name the 2nd WBk;
CURRENT_WORKBOOK.xlsm

The code assumes the WBk's are are in C:\

Use the F8 key to step through the macro for testing.


Code:
Sub Transfer_Test() Application.DisplayAlerts = False Workbooks.Open Filename:="C:\CURRENT_WORKBOOK.xlsm" Windows("MASTER_WORKBOOK.xlsm").Activate Sheets("Sheet1").Select Sheets("Sheet1").Copy Before:=Workbooks("CURRENT_WORKBOOK.xlsm").Sheets(1) Application.WindowState = xlMinimized ActiveCell.FormulaR1C1 = "" ActiveWorkbook.SaveAs Filename:= _ "C:\CURRENT_WORKBOOK.xlsm", FileFormat:=xlOpenXMLWorkbookMacroEnabled, CreateBackup:=False ActiveWindow.Close ActiveWorkbook.Save Application.DisplayAlerts = True End Sub
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is On
Forum Jump



All times are GMT +10. The time now is 10:13 PM.


Powered by: vBulletin Version 3.0.3
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
©2008 OZmium Pty. Ltd. All rights reserved . ACN 091184655