![]() |
Copy range to different columns depending on cell value
What I would like to do is look at a range (A6:IXXX), where XXX is the
last row of the range, and if there is NOT an "X" in I6, copy that row to another range (K6:S6), this would look at each row and copy to the new range if "I" is empty. Is this possible to do? |
Copy range to different columns depending on cell value
Try this
Sub MoveRange() Dim I As Long Dim aLastRow As Long Dim dLastRow As Long Dim ws As Worksheet Dim aRange As Range Dim dRange As Range Set ws = Worksheets(2) aLastRow = ws.Cells(Rows.Count, 1).End(xlUp).Row For I = 6 To aLastRow Set aRange = Range("I" & I) If aRange.Value < "X" Then Set aRange = Range("A" & I, aRange) dLastRow = dLastRow + 1 Set dRange = Range("K" & dLastRow) aRange.Cut dRange End If Next End Sub "Fester" wrote: What I would like to do is look at a range (A6:IXXX), where XXX is the last row of the range, and if there is NOT an "X" in I6, copy that row to another range (K6:S6), this would look at each row and copy to the new range if "I" is empty. Is this possible to do? . |
All times are GMT +1. The time now is 12:28 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com