VBA Worksheet calculation

Questions about integrating Excel and Cymatic, programming, formulae, etc

VBA Worksheet calculation

Postby adenlark » Tue Apr 04, 2017 10:00 pm

I'm wondering if any VBA whizzes out there can help me. I've recently started converting my workbooks from formulas to VBA, and I now have several workbooks where commands, odds and stakes are handled by VBA. These all have the various buttons, VBA modules etc in the main Cymatic sheet, and work fine.

I've now decided to clean up the interface by moving it to Sheet2. I've altered the VBA code so that the correct odds, stake, commands etc populate the correct cells in the Cymatic sheet. This is where my problems began - as the Cymatic sheet is inactive, it doesn't pick up the change of values in columns BA:BC, and Cymatic does not send the orders, as Cymatic/Excel has not detected a change in those cells (I've tested this connected to a live market). I've tried using Worksheet_Change and Worksheet_Calculate events, and bits of code from MSDN to force recalculation, but so far I'm getting nowhere (aside from manually typing something in the Cymatic sheet, which successfully causes it to calculate). I must be making a noob mistake here somewhere, but I'm all out of brainpower! Could anyone advise me on what code/event/whatever to use in order to ensure the Cymatic sheet updates/recalculates on every refresh?

Cheers

adenlark
Wealth can neither be created nor destroyed. It is simply transferred from one illusion to another. - some guy on the internet
adenlark
 
Posts: 83
Joined: Sun Aug 03, 2014 10:00 pm

Re: VBA Worksheet calculation

Postby Cym27 » Wed Apr 05, 2017 12:47 pm

It's a bit difficult to advise without seeing your spreadsheet, but which sheet are you connecting the Cymatic grid to? If you want to detect changes in columns BA:BC then you need to use the Worksheet_Change function in the VBA of the sheet whose cells get changed.

Code: Select all
Private Sub Worksheet_Change(ByVal Target As Range)
    If Not Intersect(Target, Range("BA:BC")) Is Nothing Then
        Application.EnableEvents = False
        On Error Resume Next
....
Do Stuff
...
        On Error GoTo 0
        Application.EnableEvents = True
    End If
End Sub

Cym27
 
Posts: 149
Joined: Sun Jul 19, 2015 9:47 pm


Return to Excel - Help / Support

Who is online

Users browsing this forum: No registered users and 0 guests

cron