VBA problem - subroutine not running

Please post any questions regarding the program here.

Moderator: 2020vision

VBA problem - subroutine not running

Postby apollo » Sun Jan 11, 2015 1:11 pm

I'm having trouble running VBA code. BA is updating my Excel spreadsheet but the Worksheet_Change(ByVal Target As Range) function isn't being called. In order to investigate I've stripped the code down to the following - the worksheet it is attached to is called 'master'. It is the only instance of code attached to a worksheet and the only instance of code using a 'change' event. Other code is residing in modules as subroutines but isn't being called.


Private Sub Worksheet_Change(ByVal Target As Range)

MsgBox ("pre 16 count check")

If Target.Columns.Count = 16 Then

Application.EnableEvents = False

MsgBox ("after 16 count check")

Application.EnableEvents = True

End If

End Sub

-----------

I can see the data being updated on the sheet but no 'msgbox' messages appear. I'm baffled. Anyone?
apollo
 
Posts: 6
Joined: Mon May 26, 2014 12:23 pm

Re: VBA problem - subroutine not running

Postby bolpx001 » Mon Jan 12, 2015 2:47 pm

I had a similar issue and discovered it was because the initial routine was interrupted and that had left Application.EnableEvents set to false I wrote another sub to set Application.EnableEvents = True and everything worked out fine - Paul
bolpx001
 
Posts: 297
Joined: Sat Nov 19, 2005 4:30 am
Location: Dublin, Ireland

Re: VBA problem - subroutine not running

Postby apollo » Tue Jan 13, 2015 5:41 pm

Thanks for the reply Paul - I haven't tested it yet but your answer sounds very convincing. As I'm building a spreadsheet and running it as I go it is sometimes left in an unresolved state as I debug an issue. I'm confident that you're right - thanks again - Dean
apollo
 
Posts: 6
Joined: Mon May 26, 2014 12:23 pm


Return to Help

Who is online

Users browsing this forum: Google [Bot] and 40 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.