ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Problems Programming a sort to move rows (https://www.excelbanter.com/excel-programming/354005-problems-programming-sort-move-rows.html)

Jordan[_4_]

Problems Programming a sort to move rows
 
Hi all,
I have posted before and you have been of great help. I am
relatively new at programming and working to piece together a program
to sort through a very large database. Based on one cells value being
even or odd, I need to then move that entire row to another worksheet.
Here is my programming, thanks for your time:

Sub WIDSSORT()
Worksheets("Sheet2").Activate
For Each c In Worksheets("Sheet2").Range("E2:E11450").Cells
If c.Value / 2 Mod 0 = 1 Then
GoTo moveroweven
Else:
GoTo moverowodd
End If
Next
On Error Resume Next
moveroweven:
good = Rows.Active
Rows(good).Cut
Sheet57.Activate
rowtomoveto = Str(Trim(Sheet57.UsedRange.Rows.Count + 1))
Rows(rowtomoveto).Select
ActiveSheet.Paste

moverowodd:
good = Rows.Active
Rows(good).Cut
Sheet3.Activate
rowtomoveto = Str(Trim(Sheet3.UsedRange.Rows.Count + 1))
Rows(rowtomoveto).Select
ActiveSheet.Paste

End Sub


Jordan[_4_]

Problems Programming a sort to move rows
 
I apolagize, I forgot to mention that I am getting alot of problems
with this code, initially a subscript our of range error. Any help I
can get would be great, thanks.



All times are GMT +1. The time now is 01:23 PM.

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