I have 3 sheets (sheet1,sheet2,sheet3) in sheet1 has all user ID, sheet2 has logon user ID and sheet3 is empty. The point is... I need to put not logon user ID into sheet3 but my code fail. If it's a stupid question that because I'm newbie with VBA
Here my code:
Sub NotLog()
Dim c1 As Range
Dim c2 As Range
Dim c3 As Range
Dim sh1 As Worksheet
Dim sh2 As Worksheet
Dim sh3 As Worksheet
Set sh1 = ThisWorkbook.Sheets("ALl USer")
Set sh2 = ThisWorkbook.Sheets("8_Logon_SOE_by_group")
Set sh3 = ThisWorkbook.Sheets("Not Logon")
For Each c1 In sh1.Range("A2:A99")
For Each c2 In sh2.Range("A3:A99")
If c1 <> c2 Then
For Each c3 In sh3.Range("A2:A99")
If IsEmpty(Range("c3").Value) = True Then
c3 = c1
ElseIf IsEmpty(Range("c3").Value) = False Then
Exit For
End If
Next c3
Else
Exit For
End If
Next c2
Next c1
End Sub
https://i.sstatic.net/2kDEH.png ......It's my output. https://i.sstatic.net/IWSZM.png ......It should be like this.