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: 25
Default Help With VBA Copy Code

Im using this vba code to copy each row that has a certain value in it
to another sheet. What I want to know is how can I get it to not copy
and paste the entire row, just A through P, like A3:P3.?

I call it by using this..

copyplayer "HidRatings", "PR Current", "12", "RB", "C", "2"


Sub copyplayer(ByVal copyfromname, copytoname, copytorow, position,
columnsearch, StartRow)
Application.ScreenUpdating = False
Dim LSearchRow As Integer
Dim LCopyToRow As Integer

LSearchRow = StartRow
LCopyToRow = copytorow

Sheets(copyfromname).Select
While Len(Range(columnsearch & CStr(LSearchRow)).Value) 0
If Range(columnsearch & CStr(LSearchRow)).Value = position Then
Sheets(copyfromname).Rows(CStr(LSearchRow) & ":" &
CStr(LSearchRow)).Select
Selection.Copy

Sheets(copytoname).Select
Sheets(copytoname).Range(CStr(LCopyToRow) & ":" &
CStr(LCopyToRow)).PasteSpecial xlPasteValues
LCopyToRow = LCopyToRow + 1
Sheets(copyfromname).Select

End If

LSearchRow = LSearchRow + 1

Wend

Exit Sub

End Sub

Also is this the best code to use or is there some other code I can
use? Help would be greatly appreciated!
 
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
code does not copy Wanna Learn Excel Discussion (Misc queries) 2 July 28th 08 05:32 PM
Copy code Hamster07 New Users to Excel 4 January 30th 07 05:08 PM
Got the Copy/Cut Code But what is the Paste Code Corey Excel Programming 7 July 7th 06 02:23 PM
Copy Code Soniya Excel Programming 5 October 6th 04 03:10 PM
Code to copy range vs Copy Entire Worksheet - can't figure it out Mike Taylor Excel Programming 1 April 15th 04 08:34 PM


All times are GMT +1. The time now is 07:36 PM.

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

About Us

"It's about Microsoft Excel"