Author Topic: Excel Macros  (Read 2385 times)

Tags:
  • All members
  • Posts: 48
Excel Macros
« on: 04 Jan 2014, 06:34 »
Hi

Is there a way to activate/run an Excel macro through a trigger?  If not, is it possible to add this feature (action) in future versions?

Regards
RB

  • Moderator
  • Posts: 3597
*
Re: Excel Macros
« Reply #1 on: 04 Jan 2014, 13:15 »
Hi
Yes, you can do that by running a macro based on the value of a cell. You will set the cell value using a trigger. Please see the attached files as an example.
I can’t upload a .xlsm file, so have renamed it .xls. Once you have downloaded it, please rename it .xlsm (it’s clean!)

The Excel file contains a recorded macro called BackMatched which simply puts the text “back matched” in cell Sheet1!E6
The VBA code below checks cell D2 and if the value is 1 it runs the BackMatched macro
The trigger file writes “1” to cell D2 when the fav back_matched is greater than 0

Paste the code into the Visual Basic of the sheet you want.
Code: [Select]
Private Sub Worksheet_Change(ByVal Target As Range)
   If Target.Address = "$D$2" And Range("D2") = 1 Then
      Call BackMatched
   End If
End Sub
Please read the following disclaimer with regards to the information you may request and obtain on our forum. This specifically concerns trigger files and various instructions as to how to implement a strategy.

 

Please note, BetFair is seems to be currently OFFLINE