![]() |
Make a loop to Find a value then move a row of cells
I have imported a report into excel.
In column A I need to look for the word "set value". When I find "set value" in column A I need to move a row of cell that start in column C and are located one row below where where the word "set value" is located to the same row that "Set value" is located. I need to do this for the entire report. |
Make a loop to Find a value then move a row of cells
Hi Bill
The below moves data in columns C to E up one line, change 5 for the number of the column you need to end with . Public Sub MoveStuff() Dim lngLastRow, lngRow As Long With ActiveSheet lngLastRow = Cells.SpecialCells(xlCellTypeLastCell).Row For lngRow = 1 To lngLastRow If Left(.Cells(lngRow, 1).Value, 9) = "Set value" Then .Range(.Cells(lngRow, 3), .Cells(lngRow, 5)).Value = ..Range(.Cells(lngRow + 1, 3), .Cells(lngRow + 1, 5)).Value .Range(.Cells(lngRow + 1, 3), .Cells(lngRow + 1, 5)).Value = Null End If Next End With End Sub -- Tony Green "Bill F" wrote: I have imported a report into excel. In column A I need to look for the word "set value". When I find "set value" in column A I need to move a row of cell that start in column C and are located one row below where where the word "set value" is located to the same row that "Set value" is located. I need to do this for the entire report. |
All times are GMT +1. The time now is 10:06 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com