Hi there....
I am working on a code that copies information to another sheet and then places the information in the next blank cell.
I have a code that im trying to use (Taken from a userform) that doesn't work how I would like it. It doesn't move to the next blank cell and copy.
Sub Transfer2direct()
Application.ScreenUpdating = False
Dim free_row As Integer
' This counts the number of rows in use, and adds 1 to find the next empty one
free_row = Worksheets("Direct Report").UsedRange.Rows.Count + 1
' "With" statement to save on the amount of code
With Worksheets("Direct Report")
On Error Resume Next
Sheet2.Visible = xlSheetVisible
Sheet20.Visible = xlSheetVisible
'Unhides both sheets
On Error Resume Next
With Sheets("timesheet").Select
Selection.AutoFilter Field:=5, Criteria1:="Direct (Desp) / 817"
End With
On Error GoTo 0
With Columns("F:H").Select
Selection.EntireColumn.Hidden = False
Selection.AutoFilter Field:=6, Criteria1:="EARLY"
Sheet12.Visible = xlSheetVisible
Range("timesheet2").Select
Selection.Copy
Sheets("Direct Report").Select
Rows("2:40").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
End With
On Error Resume Next
With Sheets("timesheet").Select
Selection.AutoFilter Field:=5, Criteria1:="Direct (Desp) / 817"
End With
On Error GoTo 0
With Columns("F:H").Select
Selection.EntireColumn.Hidden = False
Selection.AutoFilter Field:=6, Criteria1:="LATE"
Sheet12.Visible = xlSheetVisible
Range("timesheet2").Select
Selection.Copy
Sheets("Direct Report").Select
End With
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Range("a2:a39").SpecialCells(xlCellTypeBlanks).EntireRow.Hidden = False
End With
End Sub
Can anyone suggest what I can do to get this working?
Thanks