I am quite new to Excel VBA. I'm triggering several macros depending on the inputs on a particular cell on the work sheet.
I have no problem with the first 2 options. But everytime I use the third option, which is Delete Row, & everytime I edit a cell or delete a cell, I encounter the error.
The code is below:
Sub Worksheet_Change(ByVal Target As Range)
Set Target = ActiveCell
If Target.Value = "Fuel Supply" Then (<=Error At This Point)
Fuel_Heating_Value
ElseIf Target.Value = "Add Row" Then
Insert_New_Row
ElseIf Target.Value = "Delete Row" Then
Delete_Row
Else:
End If
End Sub
The error is always at the third line of the code in the 1st option statement.
The 3rd option code is below:
Sub Delete_Row()
'
' Delete_Row Macro
'
Application.ScreenUpdating = False
ActiveCell.Select
ActiveCell.EntireRow.Select
Selection.Delete Shift:=xlUp
ActiveCell.Select
ActiveCell.Offset(-1, 12).Select
ActiveCell.Select
Selection.Copy
ActiveCell.Offset(1, 0).Select
ActiveSheet.Paste
Application.CutCopyMode = False
ActiveCell.Offset(0, -11).Select
Application.ScreenUpdating = True
End Sub
Any help to eliminate this problem will be appreciated.
Thanks.