Office scripts: How to count cells in range in multiply sheets

Alfi

New Member
Joined
Oct 14, 2021
Messages
5
Office Version
  1. 365
Platform
  1. Windows
  2. MacOS
  3. Mobile
  4. Web
Hi all, i was working with VBA scripts many years but i really dont get how can i run my scripts into office 365. Specially i did i simple script to count cells in range in multiply sheets. see below. But i completely dont understand how to run it in Office script.

VBA Code:
Sub SumValueAcrossTabs()
Dim i As Integer
Dim ws_num As Integer
Dim ws As Worksheet
Dim SumRg As Range
Dim x As Long
x = 0
ws_num = ThisWorkbook.Worksheets.Count
For i = 1 To ws_num
 ThisWorkbook.Worksheets(i).Activate
    Set SumRg = ActiveSheet.Range("Q4:Q400")
    Range("W1").Value = WorksheetFunction.Count(SumRg)
Next
For i = 1 To ws_num
    x = x + Sheets(i).Range("W1").Value
Next i
Sheet1.Range("C10").Value2 = x
End Sub
 

Excel Facts

Why does 9 mean SUM in SUBTOTAL?
It is because Sum is the 9th alphabetically in Average, Count, CountA, Max, Min, Product, StDev.S, StDev.P, Sum, VAR.S, VAR.P.
That's because Office Script is different programming language than VBA. My admittedly limited understanding is that the language used is TypeScript, which is apparently a superset of JavaScript.
 
Upvote 0
i'm not sure where to find the object classes and class properties. even if i convert my formula and functions it's still problem to find right classes.
 
Upvote 0
I do not think that you will find much help about office script in this forum. This thread may be of interest to you.

 
Upvote 0

Forum statistics

Threads
1,215,417
Messages
6,124,777
Members
449,187
Latest member
hermansoa

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