select a cell from basic code

Hello everybody
how do i select a calc cell from basic code?
For example, with Excel VBA a command similar to SetFocus was used.
thank you

Do you want graphically select a cell, or do you want to put some value of formula into a cell?

I found the solution

the program below moves the cell selection to the D:18 coordinate

REM  *****  BASIC  *****

sub pino
rem ----------------------------------------------------------------------
rem define variables
dim document   as object
dim dispatcher as object
rem ----------------------------------------------------------------------
rem get access to the document
document   = ThisComponent.CurrentController.Frame
dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")
REM-----------------------------------------------------------------------
dim args2(0) as new com.sun.star.beans.PropertyValue
args2(0).Name = "ToPoint"
args2(0).Value = "$D$18"
dispatcher.executeDispatch(document, ".uno:GoToCell", "", 0, args2())
rem ----------------------------------------------------------------------
end sub

(Changed to preformatted text for better readability by @Lupp )

I found another solution.

Sub pino2
  With ThisComponent.CurrentController
    .select(.ActiveSheet.getCellRangeByName("B3:C5"))
  End With
End Sub

In generally, for manipulate cells, not is necessary selected it, only for you consideration.

It can be used as SubMacro and use the command GoToLocal “xLocal” in the main macro, it accepts: single cell(B3), area(D2:F7), sheet(Sheet1) and named area(AREANAMED).

Sub GoToLocal ( xLocal As String )
Dim xLoc(0) as new com.sun.star.beans.PropertyValue
xLoc(0).Name = "ToPoint" : xLoc(0).Value = xLocal
createUnoService("com.sun.star.frame.DispatchHelper") _
.executeDispatch(ThisComponent.CurrentController _
.Frame, ".uno:GoToCell", "", 0, xLoc())
end Sub

I’m Loki6659, I created another account because I can’t log in
Thanks, great Macro. It works great