my office script to replace blanks with 0 is not working

Reecenorman1996

New Member
Joined
Jul 20, 2023
Messages
31
Office Version
  1. 365
Platform
  1. Windows
function main(workbook: ExcelScript.Workbook) {
let table1 = workbook.getTable("Table1");
// Replace all "" with "0" on table table1
table1.getRange().replaceAll("", "0", {completeMatch: true, matchCase: true});
let selectedSheet = workbook.getActiveWorksheet();
// Set format for range G:G on selectedSheet
selectedSheet.getRange("G:G").setNumberFormatLocal("[$-x-systime]h:mm:ss AM/PM");
}

the above works if i am not trying to find blanks , i need to use this code in power automate as run a script so cant use the above as a vba
 

Excel Facts

Excel Joke
Why can't spreadsheets drive cars? They crash too often!
Are the cells actually empty, or do they have formulas returning "" in them?
 
Upvote 0
Are the cells actually empty, or do they have formulas returning "" in them?
The cells are empty when i use the select and replace it works, so i recorded the action as a script , which is the above but doesn't work
 
Upvote 0

Forum statistics

Threads
1,215,133
Messages
6,123,235
Members
449,092
Latest member
SCleaveland

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top