You are on page 1of 2

Private Sub CommandButton1_Click() UserForm1.Hide Dim id1 As String, id2 As String Dim i As Integer, j As Integer count = Sheet2.Range("C1").

Value id1 = UserForm1.TextBox1.Text id2 = UserForm1.TextBox2.Text For i = 1 To count If Sheet2.Cells(i + 4, 2).Value = id1 Then For j = 1 To count If Sheet2.Cells(3, j + 2).Value = id2 Then Sheet2.Cells(i + 4, j + 2).Value = 1 Else Sheet2.Cells(i + 4, j + 2).Value = 0 End If Next j End If If Sheet2.Cells(i, 20).Value = id1 Then Sheet2.Cells(i, 21).Value = id2 ElseIf Sheet2.Cells(i, 20).Value = id2 Then Sheet2.Cells(i, 19).Value = id1 End If Next i Connect End Sub Function Connect() Dim id1 As String, id2 As String, id3 As String Dim lastrow As Integer, i As Integer lastrow = Range("T6000").End(xlUp).Row 'CB Name Store column For i = 1 To lastrow id1 = Sheet2.Cells(i, 20).Value id2 = Sheet2.Cells(i, 19).Value id3 = Sheet2.Cells(i, 21).Value rearrange id2, id3 Next i End Function Sub rearrange(id2 As String, id3 As String) count = Sheet2.Range("C1").Value For i = 1 To count If Sheet2.Cells(i + 4, 2).Value = id2 Then For j = 1 To count If Sheet2.Cells(3, j + 2).Value = id3 Then Sheet2.Cells(i + 4, j + 2).Value = 1 End If Next j End If Next i End Sub Sub correct_date() ' Get rownumber of lastrow of data Col A lastrow = Range("C6000").End(xlUp).Row ' Check row 1 to last row #, Col A For i = 1 To lastrow ' If longer than 55 chars

If Len(Cells(i, 3)) > 1 Then ' Cut to 55 chars Cells(i, 3) = Left(Cells(i, 3), 1) End If ' Not longer than 55 - get next row Next i End Sub