ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Want to move records (https://www.excelbanter.com/excel-programming/283196-want-move-records.html)

Phillips

Want to move records
 
I would like to move records based on a flag.

I do NOT want to just copy the record.

How do you do this?

I would like to walk the records, and then if the flag is true, them move it
to a diff worksheet.
I imagine it would be something like:


sub MoveRec
reccount= RowCount
for i =1 to reccount
if active.cell(0,3) then
Worksheets("Sheet1").Range("A:ZZ").Cut
ActiveSheet.Paste Destination:=Worksheets("Sheet2").Range("A:ZZ")
endif

next i
end sub

Will this work? I don't want to try it until I get somebodys OK that this
will do what I want it to do.

Is there a better way to do this?
Thanks
Phil




Don Guillett[_4_]

Want to move records
 
I see a couple of things
if active.cell(0,3) then

if the offset cell = ________???

Worksheets("Sheet1").Range("A:ZZ").Cut
ActiveSheet.Paste Destination:=Worksheets("Sheet2").Range("A:ZZ")


Worksheets("Sheet1").Range("A:ZZ").Cut _
Worksheets("Sheet2").Range("A:ZZ")

This should help. Don't be afraid to experiment if you don't SAVE and/or you
have a backup.
--
Don Guillett
SalesAid Software

"Phillips" wrote in message
news:MEdvb.61764$Dw6.331852@attbi_s02...
I would like to move records based on a flag.

I do NOT want to just copy the record.

How do you do this?

I would like to walk the records, and then if the flag is true, them move

it
to a diff worksheet.
I imagine it would be something like:


sub MoveRec
reccount= RowCount
for i =1 to reccount
if active.cell(0,3) then
Worksheets("Sheet1").Range("A:ZZ").Cut
ActiveSheet.Paste Destination:=Worksheets("Sheet2").Range("A:ZZ")
endif

next i
end sub

Will this work? I don't want to try it until I get somebodys OK that this
will do what I want it to do.

Is there a better way to do this?
Thanks
Phil







All times are GMT +1. The time now is 11:14 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com