OpenOffice.org Forum at OOoForum.orgThe OpenOffice.org Forum
 
 [Home]   [FAQ]   [Search]   [Memberlist]   [Usergroups]   [Register
 [Profile]   [Log in to check your private messages]   [Log in

Macro, help me with show/hide macro

 
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Macros and API
View previous topic :: View next topic  
Author Message
MR_Andrewas
Newbie
Newbie


Joined: 10 May 2007
Posts: 4

PostPosted: Thu May 10, 2007 5:24 am    Post subject: Macro, help me with show/hide macro Reply with quote

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 Rolling Eyes
Back to top
View user's profile Send private message
Villeroy
Super User
Super User


Joined: 04 Oct 2004
Posts: 10106
Location: Germany

PostPosted: Thu May 10, 2007 7:50 am    Post subject: Reply with quote

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 https://forum.openoffice.org
Back to top
View user's profile Send private message
MR_Andrewas
Newbie
Newbie


Joined: 10 May 2007
Posts: 4

PostPosted: Thu May 10, 2007 10:19 pm    Post subject: Reply with quote

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
View user's profile Send private message
Villeroy
Super User
Super User


Joined: 04 Oct 2004
Posts: 10106
Location: Germany

PostPosted: Fri May 11, 2007 2:54 am    Post subject: Reply with quote

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 https://forum.openoffice.org
Back to top
View user's profile Send private message
MR_Andrewas
Newbie
Newbie


Joined: 10 May 2007
Posts: 4

PostPosted: Mon Jun 11, 2007 11:59 pm    Post subject: Reply with quote

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
View user's profile Send private message
Villeroy
Super User
Super User


Joined: 04 Oct 2004
Posts: 10106
Location: Germany

PostPosted: Tue Jun 12, 2007 12:06 am    Post subject: Reply with quote

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 https://forum.openoffice.org
Back to top
View user's profile Send private message
MR_Andrewas
Newbie
Newbie


Joined: 10 May 2007
Posts: 4

PostPosted: Tue Jun 12, 2007 1:20 am    Post subject: Reply with quote

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... Smile
Back to top
View user's profile Send private message
Villeroy
Super User
Super User


Joined: 04 Oct 2004
Posts: 10106
Location: Germany

PostPosted: Tue Jun 12, 2007 1:31 am    Post subject: Reply with quote

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 https://forum.openoffice.org
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Macros and API All times are GMT - 8 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group