Copy range to different columns depending on cell value

F

Fester

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?
 
J

Jeff

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top