VBA to Office Scripts

Copper Contributor

Hello everyone.

 

I finally got the VBA code that I needed to work for the excel document I've been working on only to find out that VBA isn't supported on sharepoint.  Instead I have to use office scripts to do the same thing.  However, I am not familiar with typescript.  Can someone help me create the same effect included in this code to office scripts typescript?

 

Private Sub Workbook_Open()
'Declaring variables
Dim ws As Worksheet
Dim wt As Worksheet
Dim i As Long
Dim Lastrow As Long
Dim NewRecordsRow As Long
Application.ScreenUpdating = False
Set ws = Worksheets("List of UPCs")
Set wt = Worksheets("Historical Data")
Lastrow = ws.Range("B" & ws.Rows.Count).End(xlUp).Row
NewRecordsRow = wt.Range("B" & wt.Rows.Count).End(xlUp).Row
For i = 2 To Lastrow
If ws.Cells(i, "E").Value < Date Then
NewRecordsRow = NewRecordsRow + 1
ws.Cells(i, "E").EntireRow.Copy Destination:=wt.Cells(NewRecordsRow, 1)
ws.Range(ws.Cells(i, 3), ws.Cells(i, 5)).Clear
End If
Next i
Application.ScreenUpdating = True
MsgBox "Fill in any blank Column E fields with the formula =today(). This ensures certain functions act accordingly."
End Sub

0 Replies