PC Review


Reply
Thread Tools Rate Thread

Copy and paste to other worksheets

 
 
jrrock26
Guest
Posts: n/a
 
      3rd Jun 2010
I have 4 worksheets within 1 workbook that I track issues by area. Currently
I fill out a main worksheet first and then copy and paste the specific range
to another worksheet based on that area. Does anyone know of a code that I
could use to copy a range and paste it to the designated worksheet based on
specific criteria. Ex. Column "K" has 1 letter in each cell and there is only
3 letters you can use there. L,P, or S. Based on those letters, that would
indicate moving the range to the worksheet for that letter. Please let me
know of any ideas.

Thank you,
 
Reply With Quote
 
 
 
 
Jacob Skaria
Guest
Posts: n/a
 
      3rd Jun 2010
With sheetnames L, P and S; try the below macro...

Sub CopyRowstoDifferentSheets()
Dim wb As Workbook, ws1 As Worksheet, ws2 As Worksheet
Dim lngRow As Long, lngLastRow1 As Long, lngLastRow2 As Long
Set wb = ActiveWorkbook
Set ws1 = wb.Sheets("Main")
lngLastRow1 = ws1.Cells(Rows.Count, "K").End(xlUp).Row
For lngRow = 2 To lngLastRow1
Set ws2 = wb.Sheets(CStr(ws1.Range("K" & lngRow)))
lngLastRow2 = ws2.Cells(Rows.Count, "K").End(xlUp).Row
ws1.Rows(lngRow).Copy ws2.Rows(lngLastRow2 + 1)
Next
End Sub



--
Jacob (MVP - Excel)


"jrrock26" wrote:

> I have 4 worksheets within 1 workbook that I track issues by area. Currently
> I fill out a main worksheet first and then copy and paste the specific range
> to another worksheet based on that area. Does anyone know of a code that I
> could use to copy a range and paste it to the designated worksheet based on
> specific criteria. Ex. Column "K" has 1 letter in each cell and there is only
> 3 letters you can use there. L,P, or S. Based on those letters, that would
> indicate moving the range to the worksheet for that letter. Please let me
> know of any ideas.
>
> Thank you,

 
Reply With Quote
 
Don Guillett
Guest
Posts: n/a
 
      3rd Jun 2010
If desired, send your file to my address below. I will only look if:
1. You send a copy of this message on an inserted sheet
2. You give me the newsgroup and the subject line
3. You send a clear explanation of what you want
4. You send before/after examples and expected results.


--
Don Guillett
Microsoft MVP Excel
SalesAid Software
(E-Mail Removed)
"jrrock26" <(E-Mail Removed)> wrote in message
news23BF03E-6A59-4201-A625-(E-Mail Removed)...
>I have 4 worksheets within 1 workbook that I track issues by area.
>Currently
> I fill out a main worksheet first and then copy and paste the specific
> range
> to another worksheet based on that area. Does anyone know of a code that I
> could use to copy a range and paste it to the designated worksheet based
> on
> specific criteria. Ex. Column "K" has 1 letter in each cell and there is
> only
> 3 letters you can use there. L,P, or S. Based on those letters, that would
> indicate moving the range to the worksheet for that letter. Please let me
> know of any ideas.
>
> Thank you,


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
RE: Help with some VBA code to copy and paste on new worksheets joel Microsoft Excel Programming 1 15th Apr 2009 06:34 PM
A better way to copy and paste special between worksheets seelan_naidoo@yahoo.com Microsoft Excel Programming 1 2nd Mar 2006 09:42 AM
copy multiple worksheets of a workbook, and paste onto a Word document ( either create new doc file or paste onto an existing file.) I need this done by VBA, Excel Macro Steven Microsoft Excel Programming 1 17th Oct 2005 08:56 AM
Copy and Paste between 2 worksheets with VBA =?Utf-8?B?RGF2ZSBZ?= Microsoft Excel Worksheet Functions 2 15th Jun 2005 03:47 PM
Copy/Paste to all Worksheets sharon Microsoft Excel Programming 2 11th Feb 2004 04:42 PM


Features
 

Advertising
 

Newsgroups
 


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