chris2727272727
Board Regular
- Joined
- Jul 10, 2005
- Messages
- 152
Dim a
Dim activecell
Dim keyboard
Dim tina
Dim bina
On Error Resume Next
i = 1
UserForm2.TextBox1.MultiLine = True
UserForm2.Caption = "First Aid Training Overdue"
lastrow = Range("c65536").End(xlUp).Row
For Each cell In Range("f9:m" & lastrow)
a = cell.Row
Application.ScreenUpdating = False
If cell.Value < DateTime.Date And cell.Value > DateTime.Date - 365 And cell.Font.Strikethrough = False Then
Application.Union(Range("a" & a, "d" & a), cell).Copy
UserForm2.TextBox1.Paste
End If
Next
Application.ScreenUpdating = True
UserForm2.Show
End Sub
I have the above code the trouble is that when it runs it copies all the line to the text box i only want it to copy say for example it picks an overdue date on "a7" i want it to copy a5:d5 inclusive and a8 but instead it copies all of the row to the left of the cell it finds ie a5:a8 inclusive.
Dim activecell
Dim keyboard
Dim tina
Dim bina
On Error Resume Next
i = 1
UserForm2.TextBox1.MultiLine = True
UserForm2.Caption = "First Aid Training Overdue"
lastrow = Range("c65536").End(xlUp).Row
For Each cell In Range("f9:m" & lastrow)
a = cell.Row
Application.ScreenUpdating = False
If cell.Value < DateTime.Date And cell.Value > DateTime.Date - 365 And cell.Font.Strikethrough = False Then
Application.Union(Range("a" & a, "d" & a), cell).Copy
UserForm2.TextBox1.Paste
End If
Next
Application.ScreenUpdating = True
UserForm2.Show
End Sub
I have the above code the trouble is that when it runs it copies all the line to the text box i only want it to copy say for example it picks an overdue date on "a7" i want it to copy a5:d5 inclusive and a8 but instead it copies all of the row to the left of the cell it finds ie a5:a8 inclusive.