multiple worksheets issue - help anyone?

Find a developer for your Excel triggered betting needs and advertise your development service here.

Moderator: 2020vision

multiple worksheets issue - help anyone?

Postby catface » Tue Oct 12, 2010 8:46 am

Hi guys wonder if anyone can solve this one

Working with


Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Columns.Count <> 16 Then Exit Sub
Application.EnableEvents = False



Then this bit so once a flag is set the trading is up, no further activity takes place on that sheet ( its a bit TOO good, it stops activity on all sheets thereafter... )

If Sheet1.Cells(30, 3) = True Then Exit Sub
' won't go any further if the end flag is true,

'which is my get out i.e. when the trade is complete on this worksheet, set 30,3 to true, go no further after which.

Then

....code here - to make decisions
loops based on Select Case decisions, the usual

Application.EnableEvents = True
End Sub

It works a dream on one worksheet, but although several worksheets seem to run the code at beginning, after the very FIRST of the games is traded, it won't fire triggers on any of the other worksheets. All code is specific to worksheet only, I am wondering if it's to do with events i.e. once this flag is set, events are somehow permanently disabled, so BA won't work on the other sheets.

Have looked into multi workbooks but decided that just one with multiple tabs is far more effective. However, I'm baffled why the code stalls after the very first time it's used on whatever worksheet game plays out first

Any help appreciated
Thanks and regards
Catface
catface
 
Posts: 2
Joined: Tue Oct 12, 2010 8:38 am

Postby BlueBoy » Tue Oct 12, 2010 9:20 am

You have probably covered this but does the line


If Sheet1.Cells(30, 3) = True Then Exit Sub

refer to sheet1 in every worksheet?
BlueBoy
 
Posts: 82
Joined: Fri Nov 18, 2005 9:17 pm

Postby catface » Tue Oct 12, 2010 1:18 pm

Thanks Blueboy and yes I had already covered it as I simply wrote the code to work per sheet, then copied over and did a find and replace for the Sheet it related to.

I thought it was a nifty idea as the whole setting a cell to true is a one off latch, which can be cleared each time you run the program, - and once true, that's it for operations on that sheet ie. you've made a profit or you've hedged.

The other thing is, on the four other sheets after the first one (which fired fine) there was no hedge activated, no trade out as profit its as if the whole VB process stopped dead the moment the first match was traded out of
catface
 
Posts: 2
Joined: Tue Oct 12, 2010 8:38 am

Postby mak » Tue Oct 12, 2010 3:15 pm

I am not good at vba but from some code posted from Os a very helpful member i think that he uses at his codes something like

With ThisWorkbook.Sheets("sheet1")

maybe this will help also
http://www.gruss-software.co.uk/forum/v ... =worksheet
mak
 
Posts: 1086
Joined: Tue Jun 30, 2009 8:17 am

Postby BlueBoy » Tue Oct 12, 2010 4:14 pm

When you get the first trade do you exit the sheet without
executing the line


Application.EnableEvents = True
BlueBoy
 
Posts: 82
Joined: Fri Nov 18, 2005 9:17 pm

Postby Ian » Tue Oct 12, 2010 6:05 pm

You need to put a label before the Application.EnableEvents = True statement and go to there rather than exit sub when your flag is true.
Ian
 
Posts: 834
Joined: Sat Nov 19, 2005 8:35 am
Location: Birmingham


Return to Find an Excel developer

Who is online

Users browsing this forum: No registered users and 10 guests

Sports betting software from Gruss Software


The strength of Gruss Software is that it’s been designed by one of you, a frustrated sports punter, and then developed by listening to dozens of like-minded enthusiasts.

Gruss is owned and run by brothers Gary and Mark Russell. Gary discovered Betfair in 2004 and soon realised that using bespoke software to place bets was much more efficient than merely placing them through the website.

Gary built his own software and then enhanced its features after trialling it through other Betfair users and reacting to their improvement ideas, something that still happens today.

He started making a small monthly charge so he could work on it full-time and then recruited Mark to help develop the products and Gruss Software was born.

We think it’s the best of its kind and so do a lot of our customers. But you can never stand still in this game and we’ll continue to improve the software if any more great ideas emerge.