EDIT: SHRINKED THE CODE TO THE PROBLEM SOURCE!
I'm having a really weird problem when some people tries to run my custom macro enabled sheets. As I'm testing right now, I just cant figure my error out.
The error occurs at 'obsolete' forms when i click on 'salvar' button, it says that my variable dont have the value to set into target sheet position.
HOW THIS SHEET WORKS:
Its a form quiz based on business services names located into "sistemas" sheets column A, where the user have to set up the SLA, response time and the importance of the selected service. The error occurs when one user wants to report if one services doesnt belong to them anymore, clicking in the button "Não pertence a equipe" and putting some values on the new window and then clicking in "salvar".
EXAMPLE CODES:
Userform1:
Private Sub CommandButton1_Click()
UserForm2.Show
End Sub
Private Sub UserForm_Initialize()
Dim index
count_total = Sheets("main").Range("A" & Rows.Count).End(xlUp).Row
Application.WindowState = xlMinimized
stop_process = 0
is_obsolete = False
Addition = 1
i = 1
nextComboList
End Sub
Public Sub nextComboList()
If i <= count_total Then
ComboBox1.Value = Sheets("main").Cells(i, "A").Value
End If
End Sub
Userform2:
Private Sub CommandButton1_Click()
Dim myInput
text_team = TextBox1.Value
text_manager = TextBox2.Value
If text_team = "" And text_manager = "" Then
Unload Me
ElseIf text_team = TextBox1.Value Or text_manager = TextBox2.Value Then
'THE PROBLEM SHOULD START ON THIS LINE!!!! ----- ERROR 9
Worksheets("target").Cells(i, "A").Value = sysName
Worksheets("target").Cells(i, "B").Value = text_team
Worksheets("target").Cells(i, "C").Value = text_manager
Worksheets("target").Cells(i, "D").Value = "N/P"
is_obsolete = True
i = i + 1
UserForm1.nextComboList
Unload Me
End If
If i > count_total Then
MsgBox "all items validated"
Else
Unload Me
End If
End Sub
Private Sub UserForm_Activate()
sysName = UserForm1.ComboBox1.Value
End Sub
Module1:
Public i As Integer
Public sysName As String
Public Addition As Integer
Public text_team As String
Public text_manager As String
Public count_total As Integer
Sub CallUserForm()
If debug_mode = 0 Then
Application.ScreenUpdating = False
Else
UserForm1.Show
End If
End Sub
Sub shutdown_forms()
Unload UserForm2
Unload UserForm1
End Sub