Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Copy and paste to other worksheets
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, |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Copy and paste to other worksheets
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 |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Copy and paste a name list across worksheets | Excel Discussion (Misc queries) | |||
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 | Excel Programming | |||
Copy and Paste between 2 worksheets with VBA | Excel Worksheet Functions | |||
copy/paste data between worksheets | Excel Discussion (Misc queries) | |||
Copy/Paste to all Worksheets | Excel Programming |