From: jrrock26 on 3 Jun 2010 11:40 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,
From: Jacob Skaria on 3 Jun 2010 11:46 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,
From: Don Guillett on 3 Jun 2010 11:48 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 dguillett(a)gmail.com "jrrock26" <jrrock26(a)discussions.microsoft.com> wrote in message news:D23BF03E-6A59-4201-A625-A854B152400D(a)microsoft.com... >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,
|
Pages: 1 Prev: nXn matrix creation Next: I need to use the last row of data in a formula |