Forum Discussion
ItsNursinTime
Feb 13, 2024Copper Contributor
VBA to Office Script Help
Hello, I have a VBA written that performs my task as intended. However this xlsm file needs to be sharable and edited by multiple people over Teams. As you all know, VBAs wont work using the bro...
Kirrash
Dec 11, 2024Copper Contributor
Hello. I have a VBA function that I would like converted to script in order for it to work on the sharepoint version. Please see below. If "Yes" is entered via drop down in column N, the line is copies to the historical referrals then deleted. Thank you!
Private Sub Worksheet_Change(ByVal Target As Range)
' Check to see only one cell updated
If Target.CountLarge > 1 Then Exit Sub
' Check to see if entry is made in column B after row 5 and is set to "Yes"
If Target.Column = 14 And Target.Row > 1 And Target.Value = "Yes" Then
Application.EnableEvents = False
' Copy columns B to I to complete sheet in next available row
Range(Cells(Target.Row, "A"), Cells(Target.Row, "N")).Copy Sheets("Historical Referrals").Cells(Rows.Count, "A").End(xlUp).Offset(1, 0)
' Delete current row after copied
Rows(Target.Row).Delete
Application.EnableEvents = True
End If
'ActiveSheet.Protect
'Target.Calculate
End Sub