midnight update quickpick list

Please post any questions regarding the program here.

Moderator: 2020vision

midnight update quickpick list

Postby dflowe » Thu Jul 21, 2016 12:17 am

Hi was wondering if anyone could help.... i need the words to add to the macro to get the macro to clear an area of sheet 2 in this work book
i dont seem to be able to find the right way......I have added the 2 lines in red and it clears sheet 1 ok but i want it to clear sheet 2 so I added
Range("Sheet2!A2:F200").Select but it crashes so obviously incorrect.
anyone know what i should put in??
thanks Dave

Private Sub Worksheet_Change(ByVal Target As Range)
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Columns.Count = 16 Then
Application.EnableEvents = False
If triggerQuickPickListReload Then
triggerQuickPickListReload = False
Range("Q2").Value = -3.1
triggerFirstMarketSelect = True
Else
If triggerFirstMarketSelect Then
triggerFirstMarketSelect = False
Range("Q2").Value = -5
Range("A2:F200").Select
Selection.ClearContents
End If
End If
Application.EnableEvents = True
End If
End Sub
dflowe
 
Posts: 181
Joined: Sat Dec 31, 2005 11:41 am
Location: Midlands

Re: midnight update quickpick list

Postby Marshy » Thu Jul 21, 2016 9:51 am

To select a range on sheet2 you want
Sheets("Sheet2").Range("A2:F200").select
Selection.ClearContents

but you can do it all in one line if you just want to clear the contents:
Sheets("Sheet2").Range("A2:F200").ClearConents

Hope this helps
Marshy
Marshy
Marshy
 
Posts: 10
Joined: Sat Oct 11, 2008 2:43 pm

Re: midnight update quickpick list

Postby dflowe » Thu Jul 21, 2016 10:24 am

Ahhh thanks, I was almost right but almost is not good enough in this instance

thanks again
Dave
dflowe
 
Posts: 181
Joined: Sat Dec 31, 2005 11:41 am
Location: Midlands

Re: midnight update quickpick list

Postby Captain Sensible » Thu Jul 21, 2016 11:31 am

I just set the cells to be blank whenever I want to clear a range

Sheets("Sheet2").Range("A2:F200").Value=""
User avatar
Captain Sensible
 
Posts: 2923
Joined: Sat Nov 19, 2005 2:29 pm

Re: midnight update quickpick list

Postby dflowe » Fri Jul 22, 2016 8:53 am

Thanks for the help but it still did not clear the sheet 2 overnight :( but it did update the quick pick list and set to first race.
now here is a conundrum.
If i start the system fresh.....it all works as it connects (on open)
if i run the macro.......it all works....
but it will not refresh the sheet2 at midnight so I have missed somethige maybe out of a module???????

Anyone got any ideas?

thanks dave
dflowe
 
Posts: 181
Joined: Sat Dec 31, 2005 11:41 am
Location: Midlands

Re: midnight update quickpick list

Postby Captain Sensible » Fri Jul 22, 2016 2:04 pm

Is that all the coding? Have you copied it from somewhere else? You have things duplicated like

Private Sub Worksheet_Change(ByVal Target As Range)
Private Sub Worksheet_Change(ByVal Target As Range)

the statement

If triggerQuickPickListReload Then

doesn't seem to mean anything so it will go to the else statement and trigger Q2 to equal -5 i.e go to the start of the quick pick, it'll load the quickpick by default when you open the program. Are any of these variables like triggerQuickPickListReload declared anywhere ? Might be easier to post the code you're currently using to see if there's any obvious errors rather than jus t us trying to guess.
User avatar
Captain Sensible
 
Posts: 2923
Joined: Sat Nov 19, 2005 2:29 pm

Re: midnight update quickpick list

Postby Captain Sensible » Fri Jul 22, 2016 2:10 pm

I'm sure gary posted an example sheet somewhere to reload markets at midnight. I just use code similar to this in the ThisWorkbook module to reload my quickpick routine for the morning.

Code: Select all

Option Explicit
Private Sub Workbook_Open()
Application.OnTime TimeValue("00:30:00"), "quickpick"
   
End Sub
User avatar
Captain Sensible
 
Posts: 2923
Joined: Sat Nov 19, 2005 2:29 pm

Re: midnight update quickpick list

Postby dflowe » Fri Jul 22, 2016 3:39 pm

HIya thanks for replying the code in the sheet is:-
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Columns.Count = 16 Then
Application.EnableEvents = False
If triggerQuickPickListReload Then
triggerQuickPickListReload = False
Range("Q2").Value = -3.1
triggerFirstMarketSelect = True
Else
If triggerFirstMarketSelect Then
triggerFirstMarketSelect = False
Range("Q2").Value = -5
Sheets("Sheet2").Range("A2:F200").Value = ""
End If
End If
Application.EnableEvents = True
End If
End Sub

and in the module

Public triggerQuickPickListReload As Boolean
Public triggerFirstMarketSelect As Boolean

Public Sub loadQuickPickList()
triggerQuickPickListReload = True
Application.OnTime TimeValue("00:00:00"), "loadQuickPickList"
End Sub
dflowe
 
Posts: 181
Joined: Sat Dec 31, 2005 11:41 am
Location: Midlands

Re: midnight update quickpick list

Postby Captain Sensible » Fri Jul 22, 2016 4:04 pm

Do you have the following code under ThisWorkbook? That sets the loadQuickPickList to run at 12. And then quickpicklist resets it again for 12 once it runs.

Code: Select all
Option Explicit

Private Sub Workbook_Open()
    Application.OnTime TimeValue("00:00:00"), "loadQuickPickList"
End Sub


Maybe change the line

Sheets("Sheet2").Range("A2:F200").Value = ""

to

Worksheets("Sheet2").Range("A2:F200").Value = ""

if that's not clearing things.

You can always test things by changing the times to 10 minutes from now to check they work.
User avatar
Captain Sensible
 
Posts: 2923
Joined: Sat Nov 19, 2005 2:29 pm

Re: midnight update quickpick list

Postby dflowe » Fri Jul 22, 2016 4:32 pm

thanks, cant understand why it worked when i tested the macro from the spread sheet and it worked ok at startup
dflowe
 
Posts: 181
Joined: Sat Dec 31, 2005 11:41 am
Location: Midlands

Re: midnight update quickpick list

Postby Captain Sensible » Fri Jul 22, 2016 4:38 pm

When you tested the macro you ran the loadQuickPickList routine which then resets the loadQuickPickList to run at 00:00, when you open the program it automatically loads the quickpick list by default both would trigger your -5
User avatar
Captain Sensible
 
Posts: 2923
Joined: Sat Nov 19, 2005 2:29 pm

Re: midnight update quickpick list

Postby dflowe » Fri Jul 22, 2016 4:53 pm

ahhh no it clears the sheet 2 as well in both those senarios, it just did not clear sheet 2 at midnight....thast what so confusing
dflowe
 
Posts: 181
Joined: Sat Dec 31, 2005 11:41 am
Location: Midlands

Re: midnight update quickpick list

Postby Captain Sensible » Fri Jul 22, 2016 4:58 pm

You can always put the Worksheets("Sheet2").Range("A2:F200").Value = "" within your module instead



Code: Select all
Public Sub loadQuickPickList()
triggerQuickPickListReload = True
Application.OnTime TimeValue("00:00:00"), "loadQuickPickList"
Worksheets("Sheet2").Range("A2:F200").Value = ""
End Sub
User avatar
Captain Sensible
 
Posts: 2923
Joined: Sat Nov 19, 2005 2:29 pm

Re: midnight update quickpick list

Postby dflowe » Fri Jul 22, 2016 5:06 pm

hi and thanks for that, will try that tonight in the sub routine
dflowe
 
Posts: 181
Joined: Sat Dec 31, 2005 11:41 am
Location: Midlands

Re: midnight update quickpick list

Postby dflowe » Sat Jul 23, 2016 9:09 am

hiya, thanks for your patience but that mod into the module stopped the macro completely......
and if i remove the line it works so
should there be a declaration or something as well?
dflowe
 
Posts: 181
Joined: Sat Dec 31, 2005 11:41 am
Location: Midlands

Next

Return to Help

Who is online

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