This simple macro will add 1 to the value of the currently selected cell (known as the active cell).
This increment cell value macro is useful when associated with a keyboard shortcut for counting things rapidly.
Simply create a new Macro Sub :
- In the menus, choose Macros > Organise Macros > OpenOffice Basic,
- In the dialogue box unfold the following hierarchy "My Macros > Standard > Module 1"
- Now that Module 1 is selected, click on button Edit
- Copy and Paste the code below
- Hit Save (Ctrl-S)
Sub activecellplus1
ThisComponent.CurrentSelection.value = ThisComponent.CurrentSelection.value +1
End Sub
Now to assign a keyboard shortcut:
- In Menus, choose Tools > Customize ... ,
- In Dialog, activate Tab called Keyboard
- Look for an empty shortcut key in the list and select it
- Now in the list called "Functions, Categories" scroll at the bottom of the list and look for '+ Open Office Macros'. (Click on the + to unfold) Now continue unfolding '+ User, + Standard, +Module1 '
- Now in the list called Functions, you should see an entry called 'activecellplus1' . Select it
- Now click the button called "Modify" and then OK at the bottom
Test it:
- Choose an empty cell or put a value in a cell (e.g. 5).
- Select the cell (click on it)
- Now hit the shortcut you have created and see the value increment by 1
Interesting. What do you want to use it for?
ResponderEliminar