Pushbutton +1 to cell value


I need macro to add +1 value to C1 cell

Use a SpinButton and you dont need a “macro”.
A very raw version of a solution based on a Sub is also included with this demo.

For a more elaborate way to use the ‘Tag’ for passing parameters to a Sub assigned to an event of a FormControl see this thread. It is capable of passing more than one parameter in one string. I used the (implicit) syntax applied in the event property
‘pEvent.Source.AccessibleContext.AccessibleParent.ExtendedAttributes’ e.g.

New demo concerning the comments below.

The button is not linked to any cells as FormButtons can be if their object editor has a Data tab with a property Linked cell.
The kind of “fake” linkage implemented by my code is based on the .Tag property of the respective Model. Its name in the editor is Additional information for unknown reasons, probably because the designer thought it was funnier to have the user guess the correlation between different names.
The Tag of the button in the ‘New demo’ is now evaluated for a semicolon-separated list of cell addresses.
The example has “Sheet1.C1;Sheet1.B15” there. You may add to the list regarding the obvious syntax.

The included code is raw and doesn’t test for any possible errors. It works flawlessly, however, if there aren’t such errors. Check the very simple code yourself:

Sub incBy1(pEvent)
g = Split(pEvent.Source.Model.Tag, ";")
For j = 0 To Ubound(g)
    h = Split(g(j), ".")
    theCell = ThisComponent.Sheets.GetByName(h(0)).GetCellRangeByName(h(1))
    theCell.Value = theCell.Value + 1
Next j
End Sub

(It also works with cells in different sheets.)

It is possible to add +1 to two cells same time?

Of course. See “Edit2”

Its not working its still linked only to one cell

Just downloaded the ‘New demo’ from the second edit to my answer above and tried to verify your claim. It falsified.
If will add and´’Edit3 shortly.