Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
VBA Program error...???
So I got this sort program below
sub srt() r = 1 10 if cells(r,1) = "" and cells(r,2) = "" then goto 99 if cells(r,1)=cells(r,2) then r=r+1: goto 10 if cells(r,1)<cells(r,2) then cells(r,2).select Selection.Insert Shift:=xlDown else cells(r,1).select Selection.Insert Shift:=xlDown end if r=r+1: goto 10 99 end sub It works fine however I need it to assume there is a HEADER ROW and to move cells 1-4 as a group and 5-8 as a group when cell 1 or 5 match or do not match as the program runs. Also I need it to stop when it comes to the end. Right now it continually runs the last item all the way to the bottom of the sheet cell 64336 or something like that. Please help Sample of what date looks like befo HEADER HEADER 6905-323 EE-24 NIL -1 514-312 NIL EE-22 1 850CK-3 DD-05 NIL -1 514-322 NIL EE-23 1 BB709-D DD-13 NIL -1 811-01QFB NIL DD-14 1 CC7033 DD-00 NIL -1 811-01QHBNIL DD-14 1 CC7119 DD-00 NIL -1 850CK-3 NIL DD-03 1 CMC377 EE-07 NIL -1 850CK-3 NIL DD-04 1 CMC377 EE-07 NIL -1 B0081CK-1 NIL EE-20 1 CMC377 EE-07 NIL -1 BB709-D NIL DD-12 1 CMC377 EE-07 NIL -1 CC4584 NIL DD-15 1 CMC377 EE-07 NIL -1 CC7033 NIL DD-15 1 CMC377 EE-07 NIL -1 CC7119 NIL DD-15 1 FB3648-O EE-00 NIL -1 CMC394 NIL EE-07 1 FB3672-O EE-00 NIL -1 CMC394 NIL EE-07 1 FB3648-O NIL EE-19 1 FB3672-O NIL EE-19 1 FB3672-O NIL EE-19 1 FB3673-O NIL EE-19 1 Sample of what I WANT DATA to look like before. HEADER HEADER 514-312 NIL EE-22 1 514-322 NIL EE-23 1 6905-323 EE-24 NIL -1 811-01QFB NIL DD-14 1 811-01QHBNIL DD-14 1 850CK-3 DD-05 NIL -1 850CK-3 NIL DD-03 1 850CK-3 NIL DD-04 1 B0081CK-1 NIL EE-20 1 BB709-D DD-13 NIL -1 BB709-D NIL DD-12 1 CC4584 NIL DD-15 1 CC7033 DD-00 NIL -1 CC7033 NIL DD-15 1 CC7119 DD-00 NIL -1 CC7119 NIL DD-15 1 CMC377 EE-07 NIL -1 CMC377 EE-07 NIL -1 CMC377 EE-07 NIL -1 CMC377 EE-07 NIL -1 CMC377 EE-07 NIL -1 CMC377 EE-07 NIL -1 CMC394 NIL EE-07 1 CMC394 NIL EE-07 1 FB3648-O EE-00 NIL -1 FB3648-O NIL EE-19 1 FB3672-O EE-00 NIL -1 FB3672-O NIL EE-19 1 FB3672-O NIL EE-19 1 FB3673-O NIL EE-19 1 Already have a process that SORTS it numeric to alphabetic just need to add or change the current program to do the following. If anyone can help that would be ideal. I also would like to color the discrepencies (Things that dont match) in yellow. Let me know if anyone has any great ideas or possibly a place where I can learn how to better write these things myself... Thanks Sean |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Program.xls cannot be found error | Excel Discussion (Misc queries) | |||
Excel Program Error | Excel Worksheet Functions | |||
Excel Program Link Error? | Excel Discussion (Misc queries) | |||
Copy/Paste program error | Excel Programming |