View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Jay Baxter Jay Baxter is offline
external usenet poster
 
Posts: 12
Default code to move certain rows to another sheet

Here is a piece of code I found and edited.. It may work. I have some questions on the code though..

What does "For iCt = 1 To 21" mean? What does the variable iCt do
And how do we know what numbers to make IRow1, erow, and iCt equal to...? Am a bit lost on tha

Dim iCt As Intege
Dim iRow1 As Intege
Dim iRow2 As Intege
Dim ws1 As Workshee
Dim ws2 As Workshee

Set ws1 = Sheets("Sheet1"
Set ws2 = Sheets("Sheet2"
iRow1 =
erow=
While ws2.cells(erow,1)<"":erow=erow+1:Wen
iRow2 = ero

'copy from sheet1 to sheet
Do Until ws1.Cells(iRow1, 27) = "--1
If ws1.Cells(iRow1, 28) = "Closed" The
For iCt = 1 To 2
ws2.Cells(iRow2, iCt) = ws1.Cells(iRow1, iCt
Next iC
iRow2 = iRow2 +
End I
iRow1 = iRow1 +
Loo

'delete from sheet
For iCt = iRow1 To 2 Step -
If ws1.Cells(iCt, 28) = "Yes" Then ws1.Rows(iCt).Delet
Next iC