Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.misc
|
|||
|
|||
Macro
I have a data set that is manipulated by a macro (data1) to set certain
columns in order so as to read them into another spreadsheet. Once the macro (data1) has run it sorts by column J, then highlights J1 and K1 and stops. The reason it stops is I have to select the contents that are in Col J that have a value of 1 or less and then delete those contents of the selected cells and those cells that are adjacent to the selected values in Col j in Col K. I then run another macro (data2) that deletes all of Col J, sorts by Col L and then highlights Col L1 and Col M1 and stops. The process continues until I complete Col R and Col S (data6). Then I run the last macro (data7) which does the final manipulation. I would first like to be able to create a macro that sorts, removes the contents and the adjacent contents (K) in this instance, then deletes the first column, (J) in this instance, then sorts the next columns and repeats itself until it comes up to another macro at the end that does the final manipulations ( the first and last macros are constantly changing somewhat depending on the data uploaded. All in all, I would like to create the sorting and deleting macros that I do manually now then be able to tie all of the macros into one. And, how do you tie the end of one to the beginning of another. This is an snapshot example of the data once it is first manipulated by (data1) and ready to have the values =<1 along with the adjacent value deleted in Col J and K. Notice there is a value (2) in J that would not be deleted and only requires a clear content at first then a complete deletion of Col J. The purpose is to rid the values in K that have a value attributed to anything 1 or less in J. I J K L M Distance FirstCall FirstCallLenAdj SecondCall SecondCallLenAdj 1 6.00 .50 0.54 0.50 0.25 2 6.00 1.00 0.35 0.50 0.32 3 6.00 1.00 0.26 1.00 0.45 4 6.00 2.00 0.32 2.00 0.78 This is the end of (data1) as it stops, Columns("F:F").Select Columns("F:F").EntireColumn.AutoFit Cells.Select Selection.Sort Key1:=Range("J2"), Order1:=xlAscending, Header:=xlYes, _ OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _ DataOption1:=xlSortNormal Range("J2:K2").Select This is macro2 thru macro6 only the names and col# change accordingly Sub Data2() ' ' Data2 Macro ' Macro recorded 08/07/2006 by User ' ' Keyboard Shortcut: Ctrl+w ' Columns("J:J").Select Selection.Delete Shift:=xlToLeft Cells.Select Selection.Sort Key1:=Range("K2"), Order1:=xlAscending, Header:=xlYes, _ OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _ DataOption1:=xlSortNormal Range("K2:L2").Select End Sub This is the beginning of (data7) Data7 Macro ' Macro recorded 09/06/2006 by User ' ' Keyboard Shortcut: Ctrl+u ' Range("A1:R1").Select Selection.Font.ColorIndex = 15 Selection.Font.ColorIndex = 1 Rows("2:2").Select ActiveWindow.FreezePanes = False |
#2
Posted to microsoft.public.excel.misc
|
|||
|
|||
Macro
|
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
error when running cut & paste macro | Excel Worksheet Functions | |||
Compiling macro based on cell values | Excel Discussion (Misc queries) | |||
Search, Copy, Paste Macro in Excel | Excel Worksheet Functions | |||
Closing File Error | Excel Discussion (Misc queries) | |||
Highlight Range - wrong macro, please edit. | Excel Worksheet Functions |