I know this may be a large ask and may not be possible but I am new to VBA and never really used sheets before in a very elaborate fashion. I didn't realize that the excel sheet with vba wouldn't translate to sheets so I need to convert my vba code to google script so that it will work in sheets. I need to convert my vba code that allows a multiselection dropdown as well as a cut and past from one tab to another based on a specific condition in Column A. Column H is the multi selection drop down. The other part of the code that cuts is when A says completed, denied, mistake-abandoned it should cut the whole row and put it in the corresponding tab of the same name. The code below works perfectly in my excel sheet but I have no idea how to translate it to google script.
Code:
[FONT=inherit]PrivateSubWorksheet_Change(ByValTargetAsRange)
Dim R AsRange, i AsLong, sh AsWorksheet
OnErrorGoToExitsub
Set R =Intersect(Range("A:A"),Target)
Application.EnableEvents=False
IfNot R IsNothingThen
For i = R.CountTo1Step-1
SelectCase R(i).Value
Case"Completed":Set sh =Sheets("Completed")
Case"Denied":Set sh =Sheets("Denied")
Case"Mistake-Abandoned":Set sh =Sheets("Mistake-Abandoned")
EndSelect
With R(i).EntireRow
.Copy sh.Cells(sh.Rows.Count,"A").End(xlUp).Offset(1,0)
.Delete
EndWith
Next i
EndIf
Application.EnableEvents=True
DimOldvalueAsString
DimNewvalueAsString
IfNotIntersect(Target,Range("H:H"))IsNothingThen
IfTarget.SpecialCells(xlCellTypeAllValidation)IsNothingThen
GoToExitsub
Else
IfTarget.Value=""ThenGoToExitsubElse
Application.EnableEvents=False
Newvalue=Target.Value
Application.Undo
Oldvalue=Target.Value
IfOldvalue=""Then
Target.Value=Newvalue
Else
Target.Value=Oldvalue&", "&Newvalue
EndIf
EndIf
EndIf
Application.EnableEvents=True
Exitsub:
Application.EnableEvents=True
EndSub[/FONT]
Last edited by a moderator: