Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 175
Default Problem moving records to another sheet

The macro below looks for an entry in a column (Taken By) in each line
of a list in the sheet Official List. If there is something there, it
moves that record to the sheet Deleted List, then comes back and
deletes the original line. It's suppose to go down a line, and
perform the same macro until it recognizes that there are no more
records. It seems to work except that I can't get it to move to the
next row down before looping back. I've tried inserting
ActiveCell.Offset(1, 0).Select
in various places, with no success. I get errors on that line where
ever I put it.
Is my Do statement wrong?
Any help would be appreciated.
Thanks,
J.O.

Sub MoveRecords()

Worksheets("Official List").Activate
Application.Goto Reference:="Taken_By"

Do Until IsEmpty(ActiveCell.Row)
'ActiveCell.Offset(1, 0).Select

'If there is a value in cell, then cut record
If ActiveCell.Value < "" Then
Rows(ActiveCell.Row).Select
Selection.Cut

'Goes to Deleted List to paste record
Worksheets("Deleted List").Activate
Application.Goto Reference:="Moved_To"
ActiveCell.Offset(0, 1).Select
Selection.End(xlDown).Select
ActiveCell.Offset(1, -1).Select
ActiveSheet.Paste

' Goes back to Official List to delete the empty row.
Worksheets("Official List").Activate
Rows(ActiveCell.Row).Delete

'ActiveCell.Offset(1, 0).Select

End If

'ActiveCell.Offset(1, 0).Select

Loop

End Sub

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default Problem moving records to another sheet

Sub MoveDate()
Dim rng as Range, rng1 as Range
Application.Goto Reference:="Taken_By"
set rng = Range(ActiveCell,activecell.End(xldown))
set rng1 = range("MovedTo")
if rng1.offset(1,0) = "" then
set rng1 = rng1(1)
else
set rng1 = rng1.end(down)(1)
End if
if application.CountA(rng) = rng.count then
rng.Entirerow.copy Destination:= rng1.entireRow
rng.Entirerow.Delete
End if
End sub

--
Regards,
Tom Ogilvy



"excelnut1954" wrote:

The macro below looks for an entry in a column (Taken By) in each line
of a list in the sheet Official List. If there is something there, it
moves that record to the sheet Deleted List, then comes back and
deletes the original line. It's suppose to go down a line, and
perform the same macro until it recognizes that there are no more
records. It seems to work except that I can't get it to move to the
next row down before looping back. I've tried inserting
ActiveCell.Offset(1, 0).Select
in various places, with no success. I get errors on that line where
ever I put it.
Is my Do statement wrong?
Any help would be appreciated.
Thanks,
J.O.

Sub MoveRecords()

Worksheets("Official List").Activate
Application.Goto Reference:="Taken_By"

Do Until IsEmpty(ActiveCell.Row)
'ActiveCell.Offset(1, 0).Select

'If there is a value in cell, then cut record
If ActiveCell.Value < "" Then
Rows(ActiveCell.Row).Select
Selection.Cut

'Goes to Deleted List to paste record
Worksheets("Deleted List").Activate
Application.Goto Reference:="Moved_To"
ActiveCell.Offset(0, 1).Select
Selection.End(xlDown).Select
ActiveCell.Offset(1, -1).Select
ActiveSheet.Paste

' Goes back to Official List to delete the empty row.
Worksheets("Official List").Activate
Rows(ActiveCell.Row).Delete

'ActiveCell.Offset(1, 0).Select

End If

'ActiveCell.Offset(1, 0).Select

Loop

End Sub


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
moving informatiion from one sheet to a total sheet john Excel Discussion (Misc queries) 2 January 31st 08 10:17 PM
Automatically add records from a new sheet to master sheet [email protected] Excel Discussion (Misc queries) 1 January 2nd 07 08:24 PM
moving records from one sheet to other knight New Users to Excel 1 June 30th 06 02:26 AM
Moving records to a new sheet DejaVu[_57_] Excel Programming 2 December 9th 05 03:39 PM
Moving records from a sheet to another LoveCandle[_2_] Excel Programming 2 November 8th 05 06:56 AM


All times are GMT +1. The time now is 11:40 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"