Sub GetRedCells()
Dim strMyBook As String
Dim cell As Range
Dim TempBook As Workbook
On Error GoTo ErrorHandler
Application.ScreenUpdating = False
Set TempBook = Workbooks.Add
UserForm1.Show
'Change line below to suit
' strMyBook = "I:\IMF stage starts wk 30.5.xls"
strMyBook = "I:\IMF stage starts wk " & TextBox1.Value & "." & TextBox2.Value & ".xls"
Workbooks.Open Filename:=strMyBook
Range([A1], [IV1].End(xlToLeft)).Copy Destination:=TempBook.Sheets(1).Range("A1")
' Change Criteria1 to suit
Range("D:D").AutoFilter Field:=4, Criteria1:="S03E"
For Each cell In Range("E:E").SpecialCells(xlCellTypeVisible)
If cell.Interior.ColorIndex = 3 Then _
cell.EntireRow.Copy Destination:=TempBook.Sheets(1).Range("A65536").End(xlUp).Offset(1, 0)
Next cell
ActiveWorkbook.Close False
Application.ScreenUpdating = True
Range("A:P").EntireColumn.AutoFit
Range("J1").EntireColumn.AutoFit
On Error GoTo 0
Exit Sub
ErrorHandler:
MsgBox "Error: " & Err.Number & " (" & Err.Description & ")"
End Sub
Norie on line where it asks to open file the file changes on a daily basis by week no and day no thn main part of the fil;e allways stays the same
also on Range("D").AutoFilter Field:=4, Criteria1:="S03E"
i would like to get another spinbox or similar to be able to pick from the cells in col D
hope this makes sense
Merc