Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
moving cells to another column based on number of characters
I download a report each day that varies in length so my row count is
unknown. About 20 cells populate in column H that should be in column I. Below is a sample. The correct information in Col H is normally 6 characters. The longer 13 character number belongs in Col I. As you can see, the cell in column I is empty when the data is incorrectly in column H on the same row. I'm not sure the best code to put in an existing macro for the active sheet to move the cells in column H to column I when the text in the cell is greater than 6. I'm grateful for any help you can give me. H I N430AF 0009119181112 N39D93 0000730756201 0000730756201 932257786 N38C72 979722772 N42C26 0001875221211 N3677D 0009650691112 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
moving cells to another column based on number of characters
Sub MoveValues()
Dim rng as Range, cell as Range set rng = Range(cells(2,"H"),cells(rows.count,"H").end(xlup) ) for each cell in rng if len(cell) = 13 then cell.offset(0,1).value = cell.value cell.clearcontents end if next End sub test it on a copy of your data. -- Regards, Tom Ogilvy "JOUIOUI" wrote: I download a report each day that varies in length so my row count is unknown. About 20 cells populate in column H that should be in column I. Below is a sample. The correct information in Col H is normally 6 characters. The longer 13 character number belongs in Col I. As you can see, the cell in column I is empty when the data is incorrectly in column H on the same row. I'm not sure the best code to put in an existing macro for the active sheet to move the cells in column H to column I when the text in the cell is greater than 6. I'm grateful for any help you can give me. H I N430AF 0009119181112 N39D93 0000730756201 0000730756201 932257786 N38C72 979722772 N42C26 0001875221211 N3677D 0009650691112 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Count Number of Discrete Cells, Based on Another Column | Excel Discussion (Misc queries) | |||
Count number of cells and total in one column, based on another column suffix | Excel Worksheet Functions | |||
Deleting rows based on number of characters | Excel Discussion (Misc queries) | |||
How assing unique number in a column based on a combination of two cells | Excel Programming | |||
Moving Cursor once set number of characters are entered. | Excel Programming |