Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
finding cell with + and sorting
I have a range of T14:W29
Starting in T14 The values read across the rows T - U - V - W A+ needs to keep the 20 and B needs to keep the 15, ect. The values are, (with - separating the columns) for example: T - U - V - W A +2 - 20 - 15 - B CD - 10 - 5 - E +4 B - 11 - 4 - J +9 YRB +6 - 3 - 7 - Q What I need to do is identify the cells with the + and copy everything to an new range starting at T38 so the end result looks like: B - 15 - 20 - A +2 CD - 10 - 5 - E +4 B - 11 - 4 - J +9 Q - 7 - 3 - YRB +6 All of the cells that have a + in them need to be in "W" with their corresponding numbers in "V" All of the cells that have no + need to be in "T" with their corresponding numbers in "U" I hope I have explained this clearly enough. Thanks' CR |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
finding cell with + and sorting
Does this macro do what you want?
Sub MoveData() Dim X As Long, Z As Long Z = 38 For X = 14 To 29 If InStr(Cells(X, "T").Value, "+") Then Cells(Z, "W").Value = Cells(X, "T").Value Cells(Z, "V").Value = Cells(X, "U").Value Cells(Z, "T").Value = Cells(X, "W").Value Cells(Z, "U").Value = Cells(X, "V").Value Z = Z + 1 Else Range("T" & X & ":W" & X).Copy Range("T" & Z) Z = Z + 1 End If Next End Sub -- Rick (MVP - Excel) "CR" wrote in message m... I have a range of T14:W29 Starting in T14 The values read across the rows T - U - V - W A+ needs to keep the 20 and B needs to keep the 15, ect. The values are, (with - separating the columns) for example: T - U - V - W A +2 - 20 - 15 - B CD - 10 - 5 - E +4 B - 11 - 4 - J +9 YRB +6 - 3 - 7 - Q What I need to do is identify the cells with the + and copy everything to an new range starting at T38 so the end result looks like: B - 15 - 20 - A +2 CD - 10 - 5 - E +4 B - 11 - 4 - J +9 Q - 7 - 3 - YRB +6 All of the cells that have a + in them need to be in "W" with their corresponding numbers in "V" All of the cells that have no + need to be in "T" with their corresponding numbers in "U" I hope I have explained this clearly enough. Thanks' CR |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
finding cell with + and sorting
Yes, it does.
Thank you!! "Rick Rothstein" wrote in message ... Does this macro do what you want? Sub MoveData() Dim X As Long, Z As Long Z = 38 For X = 14 To 29 If InStr(Cells(X, "T").Value, "+") Then Cells(Z, "W").Value = Cells(X, "T").Value Cells(Z, "V").Value = Cells(X, "U").Value Cells(Z, "T").Value = Cells(X, "W").Value Cells(Z, "U").Value = Cells(X, "V").Value Z = Z + 1 Else Range("T" & X & ":W" & X).Copy Range("T" & Z) Z = Z + 1 End If Next End Sub -- Rick (MVP - Excel) "CR" wrote in message m... I have a range of T14:W29 Starting in T14 The values read across the rows T - U - V - W A+ needs to keep the 20 and B needs to keep the 15, ect. The values are, (with - separating the columns) for example: T - U - V - W A +2 - 20 - 15 - B CD - 10 - 5 - E +4 B - 11 - 4 - J +9 YRB +6 - 3 - 7 - Q What I need to do is identify the cells with the + and copy everything to an new range starting at T38 so the end result looks like: B - 15 - 20 - A +2 CD - 10 - 5 - E +4 B - 11 - 4 - J +9 Q - 7 - 3 - YRB +6 All of the cells that have a + in them need to be in "W" with their corresponding numbers in "V" All of the cells that have no + need to be in "T" with their corresponding numbers in "U" I hope I have explained this clearly enough. Thanks' CR |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Sorting - Finding last row | Excel Programming | |||
Excel Sorting - Finding Duplicate Entries | Excel Programming | |||
finding, sorting, put only part of a cell | Excel Worksheet Functions | |||
Finding Duplicates in a Column (Without Sorting) | Excel Discussion (Misc queries) | |||
Sorting and Finding data | Excel Discussion (Misc queries) |