LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Help with copying selected row to new sheet


With the code below I have the following problem. Please help

If the source sheet contains data on B2:B5, and "X"s on A2:A5.
Data on B2:B5 should get copied since they all have an "X" on column A.

But after running the macro only the data from B5 get copied.

Now, If I also include data on C2:C5, then everything get copied.

thanks.

This is what i am using:

Sub Priority()
Application.ScreenUpdating = False
Worksheets("Sheet2").Select
For Each r In Worksheets("Sheet2").UsedRange.Rows
n = r.Row
If Worksheets("Sheet2").Cells(n, 1) = "X" Then
Worksheets("Sheet2").Range(Cells(n, 2), Cells(n, 7)).Copy _
Destination:=Worksheets("Sheet1").Range("B65536"). End(xlUp).Offset(1,
-1)
Else
End If
Next r

Worksheets("Sheet2").Columns("A").Replace What:="X", Replacement:="*",
_
SearchOrder:=xlByColumns, MatchCase:=True

Application.CutCopyMode = True
Application.ScreenUpdating = True

End Sub


--
ATOMICLUIS
------------------------------------------------------------------------
ATOMICLUIS's Profile: http://www.excelforum.com/member.php...o&userid=28773
View this thread: http://www.excelforum.com/showthread...hreadid=484721

 
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
copying only selected data from Sheet 1 to Sheet 2 Jaf Excel Worksheet Functions 2 September 1st 09 01:01 AM
how do i make it so that when a sheat is selected either via link or tab, that xlLastCell is selected. the last on the sheet. Daniel Excel Worksheet Functions 1 July 12th 05 01:30 AM
Copying selected rows to another sheet tacarme Excel Worksheet Functions 3 June 25th 05 11:46 AM
copying selected cells to another sheet Don Excel Programming 3 November 6th 03 08:06 PM
Copying a selected used range michael Excel Programming 1 September 24th 03 02:49 PM


All times are GMT +1. The time now is 07:00 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"