View Single Post
  #7   Report Post  
Posted to microsoft.public.excel.programming
SherryW SherryW is offline
external usenet poster
 
Posts: 4
Default Newbie needs assistance with VBA code

Thanks guys, got it and I learned valuable tips. I will be able to utilize
this type of code in other applications.
--
SherryW


"JE McGimpsey" wrote:

One way:

Public Sub MoveCompleted()
Const nStatusCol As Long = 6 'Change to suit
Dim rCell As Range
Dim rCopy As Range
Application.ScreenUpdating = False
With Sheets("Sheet1")
.Rows(1).Insert
.Cells(1, nStatusCol).Value = "Temp"
.Cells(2, 1).CurrentRegion.AutoFilter _
Field:=nStatusCol, _
Criteria1:="Completed"
On Error Resume Next
Set rCopy = .Range(.Cells(2, 1), .Cells(.Rows.Count, _
1).End(xlUp)).SpecialCells(xlCellTypeVisible)
If rCopy.Cells(1).Row = 1 Then Set rCopy = Nothing
On Error GoTo 0
.Rows(1).Delete
End With
If Not rCopy Is Nothing Then
With Sheets("Sheet2")
For Each rCell In rCopy
.Rows(1).Insert
rCell.EntireRow.Copy .Cells(1, 1)
Next rCell
End With
rCopy.EntireRow.Delete
End If
Application.ScreenUpdating = True
End Sub


In article ,
SherryW wrote:

Hello, I am new to writing VBA code and am not sure where to start re writing
code to do the following with excel:

a) Find the first instance of "completed" within the status field within
the active exceptions worksheet.
b) select the row that contains this status
c) copy or cut the row and insert copied cells into row 1 of the completed
worksheet (shifting the current data down within the completed worksheet)
d) delete the completed record that was selected and copied above.
e) loop until all compled status records have been moved to the completed
worksheet.

If anyone could help me with this one I would be very appreciative!