| View previous topic :: View next topic |
| Author |
Message |
MR_Andrewas Newbie

Joined: 10 May 2007 Posts: 4
|
Posted: Thu May 10, 2007 5:24 am Post subject: Macro, help me with show/hide macro |
|
|
I need to do a macro which woul hide or show cell in calc, maybe someone could help me with this, or have done a mcro like this ?
Thanks  |
|
| Back to top |
|
 |
Villeroy Super User


Joined: 04 Oct 2004 Posts: 10065 Location: Germany
|
Posted: Thu May 10, 2007 7:50 am Post subject: |
|
|
Menu:Tools>Customize, Tab:Keyboard
Category: "Format", Function: "Hide" and "Show"
Unfortunately there are three entries "Format" and "Show".
First hides/shows selected row(s), second one hides/shows entire sheet(s), third one hides/shows column(s). _________________ Rest in peace, oooforum.org
Get help on http://forum.openoffice.org |
|
| Back to top |
|
 |
MR_Andrewas Newbie

Joined: 10 May 2007 Posts: 4
|
Posted: Thu May 10, 2007 10:19 pm Post subject: |
|
|
Thanks, but i want to show or hide specific column.
For example: push the macro button 1 and column A-D shows, push button 2 and columns A-D, hides, but C-G shows ....
Thanks, again |
|
| Back to top |
|
 |
Villeroy Super User


Joined: 04 Oct 2004 Posts: 10065 Location: Germany
|
Posted: Fri May 11, 2007 2:54 am Post subject: |
|
|
| Code: |
sheet = thisComponent.Sheets.getByIndex(0)
REM first 3 columns
colIDs = Array(0,1,2)
for i = 0 to uBound(colIDs)
col = sheet.Columns.getByIndex(i)
col.Visible = False
next
|
But I don't think it's worth it. Have you tried Data>Outline>Group,[x]Columns? _________________ Rest in peace, oooforum.org
Get help on http://forum.openoffice.org |
|
| Back to top |
|
 |
MR_Andrewas Newbie

Joined: 10 May 2007 Posts: 4
|
Posted: Mon Jun 11, 2007 11:59 pm Post subject: |
|
|
Hey thanks, but maybe you could write all macro, because i'm very good in doing macros and for me it don't work.
it is showing error on row with false
thanks again |
|
| Back to top |
|
 |
Villeroy Super User


Joined: 04 Oct 2004 Posts: 10065 Location: Germany
|
Posted: Tue Jun 12, 2007 12:06 am Post subject: |
|
|
Read again your request ("...help me with this..."). If you can not program, simply use the built-in tools.
This line should work:
| Code: |
REM wrong: col.Visible = False
col.IsVisible = False
|
_________________ Rest in peace, oooforum.org
Get help on http://forum.openoffice.org |
|
| Back to top |
|
 |
MR_Andrewas Newbie

Joined: 10 May 2007 Posts: 4
|
Posted: Tue Jun 12, 2007 1:20 am Post subject: |
|
|
thanks so as i think code should look like this for my.?
| Code: | sub Calchidecolumn
sheet = thisComponent.Sheets.getByName("Savaitinis")
REM first 3 columns
colIDs = Array(0,1,2)
for i = 0 to uBound(colIDs)
col = sheet.Columns.getByIndex(i)
REM wrong: col.Visible = False
col.IsVisible = False
next
End Sub |
but now i can only hide column for A to D, so if i want to hide for example columns E to Z i should write like Array(4,1,11)
am i correct ?
P.S. i know i would be easier to use those outlines, but i have one problem this calc thing i'm using is intented to workers who don't know what the f is outline orsimilar, so it will be easier to just put button and to tell them to push it...  |
|
| Back to top |
|
 |
Villeroy Super User


Joined: 04 Oct 2004 Posts: 10065 Location: Germany
|
Posted: Tue Jun 12, 2007 1:31 am Post subject: |
|
|
Your co-workers can call a macro (no, 2 since you need another one to un-hide) but they can not push a +/- button on top of the columns?
And you want other people to write pointless code?
Sorry. for me this is the end of topic. _________________ Rest in peace, oooforum.org
Get help on http://forum.openoffice.org |
|
| Back to top |
|
 |
|