Hello,
I am stuck on some code where I am trying to meet 2 conditions after pressing a button on my userform. First thing I do is press Button1 and then assign a variable to the contents I pull in to 2 textboxes.
Dim aVal
CommandButton1_Click()
'Bring in data
aVal = TextBox1
'rest of my code
End Sub
Now, when I press Button2, I need to check 2 things:
1. Check PC name
2. Is TextBox1 > aVal
So, if both conditions are TRUE then I want to call another sub.
CommandButton2_Click()
'Update data to Sheet1
Dim aHostName As String
aHostName = Environ$("computername")
If TextBox1 > aVal & aHostName = "LYNPC7318" Then
Call Update
End If
'run rest of code
End Sub
Now this is where I am stuck... I have tried all sorts of IF statements for this.
IF the PC name is NOT correct, but the user put more data in the textbox then I want to message them saying "Incorrect PC for updating" then exit sub.
-OR-
IF the PC name is not correct and the value of TextBox1 has not changed, then just continue with the code and do nothing. Hopefully I made sense explaining my issue. Thanks in advance!
-Mike
Bookmarks