Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Create Loop To Move Rows Based on a Cell

Status
Not open for further replies.

CurtR

Programmer
Aug 9, 2000
66
US
I am trying to create a loop that will scan a column and then move the entire row to another sheet. If cell A1 =1 then select entire row and move it to sheet B,If A1<>1 check A2 and so on down the sheet.
Thanks Curt
 
Curt,
Try this,

for iCount = 1 to wksSheetA.usedrange.rows.count
if wksSheetA.cells(icount, 1).value = 1 then
wksSheetA.cells(icount, 1).entirerow.copy
wksSheetA.paste wksSheetB.cells(icount, 1)
end if
next iCount

It might need tweeking, but it's generally correct,,,

Dan.
 
Dan,
Thanks! That (with a few adjustments) works just Great!! I am not use to VBA, or its' commands, most all of my work is in SQL. Thanks for your help. Curt
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top