I run any bit of code and get a run time error on something that works fine when its called on its own.
Here is the code i get the error with. this is located in a module and the code running has nothing to do with this at all. Any suggestions?
Code:
Sub updatecontrolnum()
Dim controller As String
Dim rng1 As Range
Dim setg As Worksheet
Dim opit As Worksheet
Dim user As String
Set setg = Sheets("Settings")
Set opit = Sheets("Options")
'On Error Resume Next
user = Sheets("Settings").USERNAME.Value
With opit.Range("LEMPNAME")
[highlight]Set rng1 = .Find(What:=user, _
After:=.Cells(.Cells.Count), _
LookIn:=xlValues, _
LookAt:=xlWhole, _
SearchOrder:=xlByRows, _
SearchDirection:=xlNext, _
MatchCase:=False)[/highlight]
If Not rng1 Is Nothing Then
controller = rng1.Offset(0, 2).Value
End If
End With
Sheets("Settings").CNTRLNUM.Value = controller & Range("CONTNUM").Value
End Sub
Here is the code i get the error with. this is located in a module and the code running has nothing to do with this at all. Any suggestions?