/
excelscript.searchdirection.yml
45 lines (39 loc) · 1.49 KB
/
excelscript.searchdirection.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
### YamlMime:TSEnum
name: ExcelScript.SearchDirection
uid: 'ExcelScript!ExcelScript.SearchDirection:enum'
package: ExcelScript!
fullName: ExcelScript.SearchDirection
summary: Specifies the search direction.
remarks: |-
#### Examples
```TypeScript
/**
* This script searches for the next instance of the text "TK" on the current worksheet.
* It then selects that cell and removes "TK" and all formatting from the cell.
*/
function main(workbook: ExcelScript.Workbook) {
// Get the used range on the current worksheet.
let range = workbook.getActiveWorksheet().getUsedRange();
// Get the next cell that contains "TK".
let tkCell = range.find("TK", {
completeMatch: true, /* Don't match if the cell text only contains "TK" as part of another string. */
matchCase: false,
searchDirection: ExcelScript.SearchDirection.forward /* Start at the beginning of the range and go to later columns and rows. */
});
// Set focus on the found cell.
tkCell.select();
// Remove the "TK" text value from the cell, as well as any formatting that may have been added.
tkCell.clear(ExcelScript.ClearApplyTo.all);
}
```
isPreview: false
isDeprecated: false
fields:
- name: backwards
uid: 'ExcelScript!ExcelScript.SearchDirection.backwards:member'
package: ExcelScript!
summary: Search in reverse order.
- name: forward
uid: 'ExcelScript!ExcelScript.SearchDirection.forward:member'
package: ExcelScript!
summary: Search in forward order.