How to Create Function - For GUI Mode Selection Cell or Ranges

Hi Friends,

I want to write FUNCTION for Gui-Mode Selecting Cell or Cells or Range or Ranges.
So, That i can use all the Macros whenever i selecting Cell or Cells or Range or Ranges…

    view = ThisComponent.CurrentController
    frame = view.getFrame
	frame.Activate
	view.Select(cell)
	view.Select(range)

for easy understandings …the below macros

Sub CellName
sheet = ThisComponent.CurrentController.ActiveSheet
cell = sheet.getCellRangeByName(“D10”)

view = ThisComponent.CurrentController
frame = view.getFrame
frame.Activate
view.Select(cell)

End Sub

Sub CellPosition
sheet = ThisComponent.CurrentController.ActiveSheet
column = 10
row = 20
cell = sheet.getCellByPosition(column, row)

	view = ThisComponent.CurrentController
	frame = view.getFrame
	frame.Activate
	view.Select(cell)

End Sub

Sub RangeName
sheet = ThisComponent.CurrentController.ActiveSheet
range = sheet.getCellRangeByName(“A5:J22”)
view = ThisComponent.CurrentController
frame = view.getFrame
frame.Activate
view.Select(range)
End Sub

Sub RangePosition
sheet = Thiscomponent.CurrentController.ActiveSheet
startColumn = 2
startRow = 7
endColumn = 10
endRow = 12
range = sheet.getCellRangeByPosition(startColumn, startRow, endColumn, endRow)

view = ThisComponent.CurrentController
frame = view.getFrame
frame.Activate
view.Select(range)

End Sub

Sub AddressLikeString
sheet = ThisComponent.CurrentController.ActiveSheet
cell = sheet.getCellRangeByName(“E7”)
range = sheet.getCellRangeByName(“F10:G20”)

	view = ThisComponent.CurrentController
        frame = view.getFrame
	frame.Activate
	view.Select(cell)
	view.Select(range)
	
	MsgBox cell.AbsoluteName
	MsgBox range.AbsoluteName

End Sub