sorry for replying to an old post but I’ve another question
can you tell me what changes I should make to this macro so that it’l target multiple sheets
Im currently using this code to add cell content in the active sheet, it enters “rob” in the in the cell directly left of a call that’s contains text “rory”. But im wondering what changes I should make so it will do this in mutliple sheets?
Const needle = "Rory "
Const searchRange = "A1:Z1500"
Set oSheet = ThisComponent.CurrentController.ActiveSheet
Set oRange = oSheet.getCellRangeByName(searchRange)
For i = 0 To oRange.Rows.getCount() - 1
For j = 0 To oRange.Columns.getCount() - 1
Set oCell = oRange.getCellByPosition( j, i )
idx = InStr(oCell.String,needle)
If ( idx > 0) Then
oCell = oRange.getCellByPosition( j-1, i )
oCell.String = "Rob"