Record Available Balance sample sheet problem

Please post any questions regarding the program here.

Moderator: 2020vision

Record Available Balance sample sheet problem

Postby brett » Sat Feb 13, 2016 1:07 am

Hello,

This very useful program only runs in compatibility mode on my 2010 Excel , and when I try to copy and paste the code, it doesn't work at all. It only works off the original downloaded sheet. I have no idea about Visual basic, has anyone got a solution to this?
Option Explicit

Dim currentMarket As String

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Columns.Count = 16 Then
If [A1] <> currentMarket Then
currentMarket = [A1]
logBalance
End If
End If
End Sub

Private Sub logBalance()
Application.EnableEvents = False
Dim r As Integer
r = 2
While Sheet2.Cells(r, 1) <> ""
r = r + 1
Wend
Sheet2.Cells(r, 1) = currentMarket
Sheet2.Cells(r, 2) = [I2]
Application.EnableEvents = True
End Sub
brett
 
Posts: 4
Joined: Sun Jun 14, 2015 2:38 am

Re: Record Available Balance sample sheet problem

Postby alrodopial » Sat Feb 13, 2016 4:56 pm

did you place the code in the "ThisWorkbook" section in VB editor?
Attachments
Screenshot_2.png
Screenshot_2.png (20.71 KiB) Viewed 21182 times
alrodopial
 
Posts: 1386
Joined: Wed Dec 06, 2006 9:59 pm

Re: Record Available Balance sample sheet problem

Postby brett » Sun Feb 14, 2016 1:50 am

Hi there alrodopial, BTW I've also been using been using your great 2009 program Recording odds with BA , but I notice this Record Available Balance sample sheet (and all the other sample sheets available) have been developed on Excel1997-2003. I want it to work on my XL2010 without compatibility mode.
Yes ThisWorkbook appears in VB editor and I click on view code on the sheet and it's pasted correctly but it doesn't work on other sheets but works perfectly on the original downloaded sheet only and it's very valuable as it updates down a column as each of your markets are opened so no need for a results sheet etc. as it all shows up in your balance if you won or lost. So how can I paste the code in XL2010 to make it work on other sheets?
brett
 
Posts: 4
Joined: Sun Jun 14, 2015 2:38 am

Re: Record Available Balance sample sheet problem

Postby alrodopial » Sun Feb 14, 2016 11:12 am

Sorry,
code goes inside "sheet1"

It's working fine for me in office 2010
alrodopial
 
Posts: 1386
Joined: Wed Dec 06, 2006 9:59 pm

Re: Record Available Balance sample sheet problem

Postby Captain Sensible » Sun Feb 14, 2016 2:41 pm

Have you pasted the code into alrodopial's other sheet? You probably need to post what code's already running as it just needs to be merged in there rather than another instance of Worksheet_Change .
User avatar
Captain Sensible
 
Posts: 2926
Joined: Sat Nov 19, 2005 2:29 pm

Re: Record Available Balance sample sheet problem

Postby brett » Sun Feb 14, 2016 11:14 pm

Yes I always put the code in sheet 1 named "Market" and the workbook I'am trying to put it in has no other code on it . I'll keep working on it but I can always make copies of the original downloaded sheet and work from there. This program is also great for using staking plans with it.
brett
 
Posts: 4
Joined: Sun Jun 14, 2015 2:38 am

Re: Record Available Balance sample sheet problem

Postby Captain Sensible » Mon Feb 15, 2016 2:12 pm

Without seeing your sheet it's hard to know where you're going wrong. It may be something as simple as your naming of cell references and the sheet your code is in. It's always worthwhile fully referencing cells such as Worksheets("Sheet1").Range("A1").Value rather than just using generic references like [A1]. Takes a little longer but when you start using more than one sheet it's worth the effort.

Maybe try it again with the cells fully referenced like below, Make sure the code is in the sheet you're linking excel to and change Sheet1 and Sheet2 to whatever your worksheets are actually called

Code: Select all
Option Explicit

Dim currentMarket As String

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Columns.Count = 16 Then
If Worksheets("Sheet1").Range("A1").Value <> currentMarket Then
currentMarket = Worksheets("Sheet1").Range("A1").Value
logBalance
End If
End If
End Sub

Private Sub logBalance()
Application.EnableEvents = False
Dim r As Integer
r = 2
While Sheet2.Cells(r, 1) <> ""
r = r + 1
Wend
Sheet2.Cells(r, 1) = currentMarket
Sheet2.Cells(r, 2) = Worksheets("Sheet1").Range("I2").Value
Application.EnableEvents = True
End Sub

User avatar
Captain Sensible
 
Posts: 2926
Joined: Sat Nov 19, 2005 2:29 pm

Re: Record Available Balance sample sheet problem

Postby brett » Tue Feb 16, 2016 12:52 am

I tried your code Captain Sensible but unfortunately it didn't work it came up with a run script debug etc. error so I went back to the original code and tried something new , putting the code in a new blank worksheet and it's working perfectly without compatibility mode that's what I wanted so all I have to do now is make copies and go from there.
So problem solved, and thank you very much for your efforts Captain Sensible and alrodopial.
brett
 
Posts: 4
Joined: Sun Jun 14, 2015 2:38 am


Return to Help

Who is online

Users browsing this forum: No registered users and 15 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.