Billdub417
New Member
- Joined
- Nov 5, 2019
- Messages
- 45
Hello,
Hopefully a relatively simple question!
I am running the below code (Sub Update()), with an If statement that identifies if there is an error. The only issue is, if it identifies an error, the module that it has run earlier "Toggle-sheets True" remains as it is, rather than reverting back to how it was.
I could do with being able to add the below "Sub toggle()" before the "Exit Sub" - any help greatly appreciated on how to do this!
thanks,
Hopefully a relatively simple question!
I am running the below code (Sub Update()), with an If statement that identifies if there is an error. The only issue is, if it identifies an error, the module that it has run earlier "Toggle-sheets True" remains as it is, rather than reverting back to how it was.
I could do with being able to add the below "Sub toggle()" before the "Exit Sub" - any help greatly appreciated on how to do this!
thanks,
VBA Code:
Sub toggle()
Sheets("sheet1").Select
If [d6] = "Monthly" Then
toggle_sheets True
Else
toggle_sheets False
End If
End Sub
VBA Code:
Sub Update()
toggle_sheets True
Sheets("sheet1").Select
With Sheet22
Dim i As Integer
i = 1
For Each cell In .Range("v3:v14").Cells
If cell.value <> 0 Then
MsgBox ("Period " & i & " does not balance")
Sheets("sheet2").Select
Exit Sub
End If
i = i + 1
Next
Sheets("sheet2").Select
End With
End Sub