Hi, everyone!
I am copying from one worksheet to another. My current code works perfectly, except it also copies the blank rows after my data. What I need it to do is only copy rows with data in column E. I also listed the range as A13 to L100, but L could be any number of rows. Can anyone help out?
Sub Rectangle1_Click()
Dim SourceRange As Range
Set SourceRange = ThisWorkbook.Worksheets("Input").Range("A13:L100")
Dim NextFreeCell As Range
Set NextFreeCell = ThisWorkbook.Worksheets("Work Transfer Log").Cells(Rows.Count, "B").End(xlUp).Offset(RowOffset:=1)
SourceRange.Copy
NextFreeCell.PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:=False, Transpose:=False
Range("E14:I100").Select
Selection.ClearContents
Range("F3:F9").Select
Selection.ClearContents
End Sub
I am copying from one worksheet to another. My current code works perfectly, except it also copies the blank rows after my data. What I need it to do is only copy rows with data in column E. I also listed the range as A13 to L100, but L could be any number of rows. Can anyone help out?
Sub Rectangle1_Click()
Dim SourceRange As Range
Set SourceRange = ThisWorkbook.Worksheets("Input").Range("A13:L100")
Dim NextFreeCell As Range
Set NextFreeCell = ThisWorkbook.Worksheets("Work Transfer Log").Cells(Rows.Count, "B").End(xlUp).Offset(RowOffset:=1)
SourceRange.Copy
NextFreeCell.PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:=False, Transpose:=False
Range("E14:I100").Select
Selection.ClearContents
Range("F3:F9").Select
Selection.ClearContents
End Sub