![]() |
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 |
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 |
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 |
All times are GMT +1. The time now is 08:34 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com