Assigning double click action to whole spreadsheet

Discuss the spreadsheet application
Post Reply
isoka
Posts: 9
Joined: Fri Feb 10, 2017 6:09 pm

Assigning double click action to whole spreadsheet

Post by isoka »

Hello,

How can I assign a double click action to the whole spreadsheet? Without having to to it for each sheet individually.
Thanks in advance.
Windows 10 64bits
LibreOffice 5.3.0.3
User avatar
Zizi64
Volunteer
Posts: 11352
Joined: Wed May 26, 2010 7:55 am
Location: Budapest, Hungary

Re: Assigning double click action to whole spreadsheet

Post by Zizi64 »

Please give us some more deatails about your problem.

Which 'double click action' did you meant?
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.
User avatar
robleyd
Moderator
Posts: 5055
Joined: Mon Aug 19, 2013 3:47 am
Location: Murbko, Australia

Re: Assigning double click action to whole spreadsheet

Post by robleyd »

I suspect this is the double-click for sheet option accessible from right click on the sheet tab and selecting Sheet Events.
Cheers
David
OS - Slackware 15 64 bit
Apache OpenOffice 4.1.15
LibreOffice 24.2.1.2; SlackBuild for 24.2.1 by Eric Hameleers
isoka
Posts: 9
Joined: Fri Feb 10, 2017 6:09 pm

Re: Assigning double click action to whole spreadsheet

Post by isoka »

Hello guys,

Sorry, I have assigned a sub to the double-click event (Edit>Sheet>Events>Double-Click). This is the sub code:

Code: Select all

Sub putx

oSheet=thiscomponent.getcurrentcontroller.activesheet
oCell = ThisComponent.getCurrentSelection()

If oSheet.name <> "Checklist" and oCell.CellAddress.Column = 0 then
  If oCell.string = "" then
    oCell.SetString("x")
  ElseIf oCell.string = "x" then
    oCell.SetString("")
  End if
End if

end sub
This should put an "x" whenever I double-click on any empty cell on column 0 as long as it is not in sheet "Checklist" (which is sheet 0). Also it should empty any cell where there is an "x" on column 0 as long as it is not in sheet "Checklist".
The problem is that it only works in sheet 1, not on other sheets which are also not named "Checklist". I need it to work across the whole spreadsheet.
When I navigate to the "events" session on sheet 1 I can see the sub correctly assigned to the double-click but there is nothing assigned to it on other sheets.

My real desire was to make it happen (the put "x", erase "x") with single-click but I have learned that is complex.

Thank you for helping!

Best regards,
Windows 10 64bits
LibreOffice 5.3.0.3
User avatar
Zizi64
Volunteer
Posts: 11352
Joined: Wed May 26, 2010 7:55 am
Location: Budapest, Hungary

Re: Assigning double click action to whole spreadsheet

Post by Zizi64 »

You must assign your macro to the double click event in every sheet.

Or you can assign your macro to a shortcut key: it will work in every sheet.

Or here is a similar topic:
viewtopic.php?f=45&t=33842
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