Auto show/hide columns/rows with dropdown list

Creating a macro - Writing a Script - Using the API (OpenOffice Basic, Python, BeanShell, JavaScript)
Post Reply
xeixtrax
Posts: 2
Joined: Wed Jul 22, 2015 5:47 pm

Auto show/hide columns/rows with dropdown list

Post by xeixtrax »

i'm searching all forum about how to auto show/hide with dropdown list using vba or filter but no luck
what i'm trying is when selected dropdown with certain value, some rows are hidden and some rows show.
in excel, it's done with :

Code: Select all

Private Sub Worksheet_Change(ByVal Target As Range)
  If Target.Column = 5 And Target.Row = 4 And Target.Value = "Diameter dan Tinggi Tabung" Then
        Application.Rows("8:23").Select
        Application.Selection.EntireRow.Hidden = False
        Application.Rows("83:99").Select
        Application.Selection.EntireRow.Hidden = False
        Application.Rows("25:80").Select
        Application.Selection.EntireRow.Hidden = True
        Application.Rows("101:148").Select
        Application.Selection.EntireRow.Hidden = True
        
ElseIf Target.Column = 5 And Target.Row = 4 And Target.Value = "Laju Alir Air Masuk" Then
        Application.Rows("25:43").Select
        Application.Selection.EntireRow.Hidden = False
        Application.Rows("101:114").Select
        Application.Selection.EntireRow.Hidden = False
        Application.Rows("45:81").Select
        Application.Selection.EntireRow.Hidden = True
        Application.Rows("8:24").Select
        Application.Selection.EntireRow.Hidden = True
        Application.Rows("83:100").Select
        Application.Selection.EntireRow.Hidden = True
        Application.Rows("115:148").Select
        Application.Selection.EntireRow.Hidden = True

ElseIf Target.Column = 5 And Target.Row = 4 And Target.Value = "Waktu Kontak" Then
        Application.Rows("45:63").Select
        Application.Selection.EntireRow.Hidden = False
        Application.Rows("116:129").Select
        Application.Selection.EntireRow.Hidden = False
        Application.Rows("65:81").Select
        Application.Selection.EntireRow.Hidden = True
        Application.Rows("8:44").Select
        Application.Selection.EntireRow.Hidden = True
        Application.Rows("83:115").Select
        Application.Selection.EntireRow.Hidden = True
        Application.Rows("130:148").Select
        Application.Selection.EntireRow.Hidden = True
    
ElseIf Target.Column = 5 And Target.Row = 4 And Target.Value = "Banyak Media" Then
        Application.Rows("65:80").Select
        Application.Selection.EntireRow.Hidden = False
        Application.Rows("131:148").Select
        Application.Selection.EntireRow.Hidden = False
        Application.Rows("8:64").Select
        Application.Selection.EntireRow.Hidden = True
        Application.Rows("83:130").Select
        Application.Selection.EntireRow.Hidden = True

Else
        
    End If

End Sub
now my question is how it can be done in OO calc?

thanks

and sorry for bad english ;)
OpenOffice 4.1 on Windows 7
User avatar
Zizi64
Volunteer
Posts: 11511
Joined: Wed May 26, 2010 7:55 am
Location: Budapest, Hungary

Re: [ASK]auto show/hide columns/rows with dropdown list

Post by Zizi64 »

The MS VBA and the Starbasic+API of the Apache LibreOffice (or LibreOffice) are NOT compatibile. You must rewrite all of your macros. (tThe LibreOffice has more compatibility with VBA, but probably that is not enough for you. You can try the

Code: Select all

Option VBASupport 1
option at begin your original VBA code
Tibor Kovacs, Hungary; LO7.5.8/25.8.5.2 /Win7-10-11 x64Prof.
PortableApps: LO3.3.0-25.8.5.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.
User avatar
Villeroy
Volunteer
Posts: 31365
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: [ASK]auto show/hide columns/rows with dropdown list

Post by Villeroy »

If your think that macros add any value to your spreadsheets while you can not program anything except recorded macros then MS Excel is your one and only tool.
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
xeixtrax
Posts: 2
Joined: Wed Jul 22, 2015 5:47 pm

Re: Auto show/hide columns/rows with dropdown list

Post by xeixtrax »

so there is no solution for this problem?
is there any code / method with same function to show or hide rows based dropdown list?
OpenOffice 4.1 on Windows 7
User avatar
Zizi64
Volunteer
Posts: 11511
Joined: Wed May 26, 2010 7:55 am
Location: Budapest, Hungary

Re: Auto show/hide columns/rows with dropdown list

Post by Zizi64 »

so there is no solution for this problem?
There is one solution:

You need study the StarBasic (or other built-in programming language of the AOO) and need study the API functions (Application Programming Interface) and then must rewritre all of your VBA macros.
(And you must use the native, International Standard ODF filetypes with your rewrited macros.)
Tibor Kovacs, Hungary; LO7.5.8/25.8.5.2 /Win7-10-11 x64Prof.
PortableApps: LO3.3.0-25.8.5.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