Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 12
Default 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?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 921
Default 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?
.

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I add a variable range of columns depending on criteria Nedgingbelle Excel Worksheet Functions 0 November 25th 09 04:18 PM
copy cell a1 to 1 of 2 wrkshts depending on the value of other cel jcurless Excel Programming 3 September 30th 08 08:07 PM
How do I copy a row depending on the content of a cell in the row Robert59 Excel Worksheet Functions 2 October 19th 07 06:26 PM
Selecting range in list of range names depending on a cell informa Courreges Excel Discussion (Misc queries) 2 June 19th 06 10:59 AM
Automated cell copy depending on cell content? Joachim Fabini Excel Programming 5 November 20th 03 07:54 AM


All times are GMT +1. The time now is 07:14 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"