Thread: [Solved] Daily Task Sheet - help
View Single Post
 
Old 03-21-2013, 09:35 AM
Malissa1578 Malissa1578 is offline Windows 7 64bit Office 2010 64bit
Novice
 
Join Date: Mar 2013
Posts: 3
Malissa1578 is on a distinguished road
Smile

Quote:
Originally Posted by macropod View Post
Hi Malissa,

I believe the following is what you're after:
Code:
Sub TasksCompleted()
Application.ScreenUpdating = False
Dim WS1 As Worksheet, WS2 As Worksheet
Dim lRow1 As Long, lRow2 As Long, i As Long
Set WS1 = Sheets("Task Sheet")
Set WS2 = Sheets("Completed Tasks")
lRow1 = WS1.Range("E" & WS1.Cells.SpecialCells(xlCellTypeLastCell).Row).End(xlUp).Row
lRow2 = WS2.Range("A" & WS2.Cells.SpecialCells(xlCellTypeLastCell).Row).End(xlUp).Row
With WS1
  For i = 2 To lRow1
    If .Cells(i, 5).Value <> "" Then
      lRow2 = lRow2 + 1
      With WS2
        .Range("A" & lRow2).Value = WS1.Range("E" & i).Value
        .Range("B" & lRow2 & ":D" & lRow2).Value = WS1.Range("B" & i & ":D" & i).Value
      End With
      WS1.Range("A" & i & ":E" & i).ClearContents
    End If
  Next
End With
Application.ScreenUpdating = True
End Sub
PS: When posting code, please use the code tags. They're on the 'Go Advanced' tab.

Thank You
Reply With Quote