Hi!
Im trying to use a for loop with multiple if statement to add a the last date of multiple events to a textbox.
1. The loop starts from the lastrow in the first column and test for a value.
2. If it finds its value its test the second column for another value.
3. If value is false it continues to test the first column for next of the same value (like 1.).
4. If the value is true in the second column it adds the datevalue in the third column to TextBox1 in UserForm1.
" Better description in the attached workbook" test.xlsm
Best regardSub test() Dim test As Worksheet Set test = ThisWorkbook.Sheets("test") lr = test.Cells(Rows.Count, 1).End(xlUp).Row For x = lr To 1 Step -1 If test.Cells(x, 1) = 5 And test.Cells(x, 2) = "test" Then Next x End Sub
Petter
Bookmarks