Excel with VBA codes, how to optimise

Discussion regarding the spreadsheet functionality of Bet Angel.
User avatar
ODPaul82
Posts: 683
Joined: Sun May 08, 2011 6:32 am
Location: Digswell Herts

It's kind of. Without going full geek, each line as you enter it gets turned into whats called op-code in the background and then when you run or compile it gets turned into p-code.
Have been coding in VBA for 20+ years now with it being my primary language. Day job is in financial systems for insurance company.
User avatar
Derek27
Posts: 23632
Joined: Wed Aug 30, 2017 11:44 am
Location: UK

ODPaul82 wrote:
Sat Mar 04, 2023 2:40 pm
It's kind of. Without going full geek, each line as you enter it gets turned into whats called op-code in the background and then when you run or compile it gets turned into p-code.
Have been coding in VBA for 20+ years now with it being my primary language. Day job is in financial systems for insurance company.
I worked in insurance as well, programming in COBOL running on an IBM mainframe under MVS. If you can write in English you can code in COBOL:

MULTIPLY A BY B GIVING C :lol:

All capital letters as well, with a maximum 80-character lines, presumably because just before my time, code was typed onto punch cards. :)
User avatar
ODPaul82
Posts: 683
Joined: Sun May 08, 2011 6:32 am
Location: Digswell Herts

Derek27 wrote:
Sat Mar 04, 2023 2:59 pm

I worked in insurance as well, programming in COBOL running on an IBM mainframe under MVS. If you can write in English you can code in COBOL:

MULTIPLY A BY B GIVING C :lol:

All capital letters as well, with a maximum 80-character lines, presumably because just before my time, code was typed onto punch cards. :)
Ha, we still have a COBOL based mainframe (AS400 virtualised) running with the vast majority of our data saved on it
There's currently a project in place to move the whole business onto Azure and not have any physical servers on premises
Want everything 64bit, I've thrown the proverbial spanner into the works by pointing out half of finance will stop working as our instance of Excel is 32bit with thousands of workbooks referencing 32bit DLL code :lol:
rain91
Posts: 114
Joined: Tue Feb 07, 2017 7:11 pm

Hi guys, can you help me please?

I have this code on the Modul (just a detail):

Code: Select all

Sub Program()

Application.EnableEvents = False

For i = 9 To 67 Step 2
'''''''''''''''''''''''''''''''''
If Range("O" & i) = "" And Range("DD" & i) <> Range("DC" & i) And Range("DD" & i) <> "" Then
Range("L" & i) = Range("DD" & i)
Range("DE" & i) = Range("F4")
Range("DC" & i) = Range("L" & i)
End If

If Range("O" & i) = "PLACED" Or Range("O" & i) = "OK" Then
Range("L" & i).ClearContents
Range("O" & i).ClearContents
End If

Application.EnableEvents = True

End Sub
And this code on all sheet (now 32 sheet)

Code: Select all

Private Sub Worksheet_Change(ByVal Target As Range)
   If Target.Address = "$C$2:$C$6" Then
     Call Program
   End If
End Sub
The performance is a bit bitter, and the refresh rate (in Guardian 20ms) is ~12sec.

But the problem, the excel do nothing, just on the active sheet (what i watch actually). Why?
User avatar
Bobajob
Posts: 179
Joined: Sun May 21, 2023 9:13 pm

Derek27 wrote:
Sat Mar 04, 2023 2:59 pm
ODPaul82 wrote:
Sat Mar 04, 2023 2:40 pm
It's kind of. Without going full geek, each line as you enter it gets turned into whats called op-code in the background and then when you run or compile it gets turned into p-code.
Have been coding in VBA for 20+ years now with it being my primary language. Day job is in financial systems for insurance company.
I worked in insurance as well, programming in COBOL running on an IBM mainframe under MVS. If you can write in English you can code in COBOL:

MULTIPLY A BY B GIVING C :lol:

All capital letters as well, with a maximum 80-character lines, presumably because just before my time, code was typed onto punch cards. :)
"programming in COBOL running on an IBM mainframe under MVS."
Those were the days, how we miss them :)
User avatar
ODPaul82
Posts: 683
Joined: Sun May 08, 2011 6:32 am
Location: Digswell Herts

rain91 wrote:
Sat Oct 14, 2023 7:55 am
Hi guys, can you help me please?

I have this code on the Modul (just a detail):
...
Try using Intersect rather doing this

Code: Select all

 If Target.Address = "$C$2:$C$6" Then
 
Also where you have "Call Program" the need to use Call was deprecated about 20 years ago.
User avatar
ShaunWhite
Posts: 9731
Joined: Sat Sep 03, 2016 3:42 am

Bobajob wrote:
Sat Oct 14, 2023 9:07 am
running on an IBM mainframe under MVS."
And then some Silicon Valley marketing guy called it a 'Cloud' and now everyone thinks it's new. :roll:

We started with dumb terminals and mainframes, and we'll end up there again. And the interveving 50yrs of wasted money and environmental impact of more and more powerful desktops will have been a waste of time.
User avatar
Bobajob
Posts: 179
Joined: Sun May 21, 2023 9:13 pm

ShaunWhite wrote:
Sat Oct 14, 2023 1:28 pm
Bobajob wrote:
Sat Oct 14, 2023 9:07 am
running on an IBM mainframe under MVS."
And then some Silicon Valley marketing guy called it a 'Cloud' and now everyone thinks it's new. :roll:

We started with dumb terminals and mainframes, and we'll end up there again. And the interveving 50yrs of wasted money and environmental impact of more and more powerful desktops will have been a waste of time.
You're right - hadn't realised that's effectively what's happening - we are all going back to being dumb and Bet Angel will be running on the cloud :)
Post Reply

Return to “Bet Angel - Spreadsheet / Excel chat”