All,
I am pretty new to coding and I am sure this question has probably been answered a million times before and people think I am complete muppet (they are not wrong)
Anyway...
So I have an excel sheet with 4 userforms which are basically duplicates of each other except the last control button which does things slightly different. Therefore a value eg. LA.Value is used in all 4 userforms.
When I originally coded it I left all the code in all the userforms and a lot of it is duplicated and it worked (after a lot of trial and error). But trying to be smart I wanted to shift the duplicated subs to a module. When I try and to this I get object error.
I am sure the fix is really simple but my hours spent trawling here and google in general have turned up nothing. Help!
Code in Userform:
Private Sub AddRowButton_Click()
BlankCatcherShort
'Sub in Module
If ExitAll = True Then
Exit Sub
End If
AddData
'Sub in userform (but want to move to module)
End Sub
Sub in module:
Sub BlankCatcherShort()
ExitAll = False
If LA.Value = "" Then
MsgBox "Local Authority not selected"
ExitAll = True
Exit Sub
End If
...
End Sub
Bookmarks