Repetative Value update

Creating a macro - Writing a Script - Using the API (OpenOffice Basic, Python, BeanShell, JavaScript)
Post Reply
Radical_Magic63
Posts: 10
Joined: Sun Dec 23, 2012 8:20 pm

Repetative Value update

Post by Radical_Magic63 »

here is an excel subroutine for what i want I just dont know how to get it for Calc

Code: Select all

Private Sub Worksheet_Change(ByVal Target As Range)

    Dim rngInterest As Range
    Application.EnableEvents = False
    On Error Resume Next
    Set rngInterest = Intersect(Target, Range("A1:A3"))
    If Not rngInterest Is Nothing Then
        If rngInterest.Cells.Count > 1 Or Target.Row = 2 Then
            MsgBox "Error - Invalid Update", vbCritical, "Computer Says No"
            Application.Undo
        Else
            Select Case Target.Row
                Case 1
                    Range("A2").Value = Target.Value
                    Range("A3").ClearContents
                Case 3
                    Range("A2").Value = Range("A2").Value - Val(Target.Value)
                    Target.ClearContents
            End Select
        End If
    End If
    Application.EnableEvents = True

End Sub
Last edited by RusselB on Sun Mar 22, 2020 2:33 pm, edited 1 time in total.
Reason: Topic split from Calc post of the same topic & author. Code tags added.
Open Office 3.1 on windows 7 64 Bit
User avatar
Zizi64
Volunteer
Posts: 11359
Joined: Wed May 26, 2010 7:55 am
Location: Budapest, Hungary

Re: Repetative Value update

Post by Zizi64 »

You MUST rewrite all of silly MS VBA procedures and functions based on the StarBasic (or any other supported programming language) and the API functions of the AOO/LO.

Or you can try the LibreOffice. That has a littlebit higher compatibility vith the VBA macros. Use the switch

Code: Select all

Option VBAsupport 1
at the begin of the Basic Module of the LibreOffice.
Tibor Kovacs, Hungary; LO7.5.8 /Win7-10 x64Prof.
PortableApps/winPenPack: LO3.3.0-7.6.2;AOO4.1.14
Please, edit the initial post in the topic: add the word [Solved] at the beginning of the subject line - if your problem has been solved.
Post Reply