Bug 58849 - Macros: VBA code - create automatically a new row - does not work in LibreOffice
Summary: Macros: VBA code - create automatically a new row - does not work in LibreOffice
Status: RESOLVED WORKSFORME
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: BASIC (show other bugs)
Version:
(earliest affected)
3.6.4.3 release
Hardware: Other Windows (All)
: medium normal
Assignee: Not Assigned
URL:
Whiteboard: BSA
Keywords:
Depends on:
Blocks: Macro-VBA
  Show dependency treegraph
 
Reported: 2012-12-29 05:39 UTC by luc
Modified: 2022-03-18 11:18 UTC (History)
5 users (show)

See Also:
Crash report or crash signature:


Attachments
the spreadsheet with the VBA-code (20.50 KB, application/vnd.ms-excel)
2012-12-29 05:39 UTC, luc
Details

Note You need to log in before you can comment on or make changes to this bug.
Description luc 2012-12-29 05:39:01 UTC
Created attachment 72233 [details]
the spreadsheet with the VBA-code

Problem description: 
Hi

In MS-Excel I ‘m using a spreadsheet with a VBA-code (which I did not create myself) whereby automatically a row is created under the row where data is inserted when, in column B, I insert whether “i” or “u” (without the brackets). The code is :


Private Sub Worksheet_Change(ByVal Target As Range)
Dim Rij As Integer, Kolom As Integer
Dim Waarde As String

  Rij = Target.Row
  Kolom = Target.Column

  If Kolom = 2 Then
    Application.ScreenUpdating = False
    Waarde = UCase(Trim(Target.Value))
    If Waarde = "I" Or Waarde = "U" Then
       Application.CutCopyMode = False
       Rows(Rij & ":" & Rij).Select
       Selection.Copy
       Selection.Insert Shift:=xlDown
       Rows(Rij + 1 & ":" & Rij + 1).Select
       Selection.PasteSpecial Paste:=xlPasteAllExceptBorders, Operation:=xlNone, _
           SkipBlanks:=False, Transpose:=False
       Selection.ClearContents
       Range("C" & Rij).Select
       Application.CutCopyMode = True
    End If
    Application.ScreenUpdating = True
  End If

(Some translations because the code is in Dutch : "Rij" = Row / "Kolom" = Column / "Waarde" = Value)

The reason for this code :

- always leave two rows open/blank between the row where data is being inserted and the sum/total of the columns F and G

- lowering the sum/totals in F and G automatically so I don’t have to create a row manually (“Insert Row”) to maintain two open/blank rows.

In LibreOffice this VBA-code works almost. (first the security for macro’s has to be set to low via extra/libreoffice/security).

When I insert “i” or u” the new row is created underneath but all the inserted data (a date in column A and “i” or “u” in column B) is deleted.

I already mentioned this problem to the developers at Novel Gooo and the were about to fix it but then this project was discontinued.

For me solving this problem is absolutely necessary to abandon MS.

Does anyone has a solution ?

Thx
Steps to reproduce:
1. ....
2. ....
3. ....

Current behavior:

Expected behavior:

              
Operating System: Windows XP
Version: 3.6.4.3 release
Comment 1 Michel Rudelle 2013-01-22 12:35:12 UTC
Hi,
I reproduce with the attached file:
The behavior does not complies with what we have with Excel 2003
Checked with:
Version 3.6.4.3 (Build ID: 2ef5aff) - Vista
Microsoft Excel 2003 SP3 - Vista

Notice that with LibreOffice 4.0.0.1, we obtain a better result:
The data is no more deleted
The only difference I noticed is that the format is not reproduced on the row inserted.
Checked with:
Version 4.0.0.1 (Build ID: 527dba6f6e0cfbbc71bd6e7b88a52699bb48799) - Vista
Comment 2 QA Administrators 2015-02-19 15:46:24 UTC Comment hidden (obsolete)
Comment 3 Buovjaga 2015-03-08 18:55:53 UTC
Confirmed loss of formatting (Date) in A4 after row insertion through macro.

Win 7 Pro 64-bit, LibO Version: 4.4.1.2
Build ID: 45e2de17089c24a1fa810c8f975a7171ba4cd432
Locale: fi_FI
Comment 4 tommy27 2016-04-16 07:27:13 UTC Comment hidden (obsolete)
Comment 5 QA Administrators 2017-05-22 13:23:52 UTC Comment hidden (obsolete)
Comment 6 QA Administrators 2020-11-01 04:19:42 UTC Comment hidden (obsolete)
Comment 7 Timur 2022-03-18 11:18:32 UTC
Seems like a record (not macro record but time record).
It was bug in 3.6 that was resolved in 4.0 and but left there 9 years.
Original macro just copies format, which LO also does, no date.