Home |
Search |
Today's Posts |
#7
![]()
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
![]()
Try the below.
Sub Copyrows() 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("AllData") lngLastRow1 = ws1.Cells(Rows.Count, "A").End(xlUp).Row For lngRow = 2 To lngLastRow1 Set ws2 = wb.Sheets(CStr(ws1.Range("A" & lngRow))) lngLastRow2 = ws2.Cells(Rows.Count, "A").End(xlUp).Row ws1.Rows(lngRow).Copy ws2.Rows(lngLastRow2 + 1) Next End Sub If this post helps click Yes --------------- Jacob Skaria "James Merrill" wrote: Bare with me here as I try to explain this because it is somewhat confusing, I will try to simplify as much as possible. I have a workbook with multiple sheets. The first sheet (AllData) contains all my data. I have 3 columns of data: Subject, Student, and Grade. Looks like this: SUBJECT STUDENT GRADE math john doe A science jane doe B english james C There are three subsequent sheets named according to the subject: "math", "science", "english" I want to move all the "math" data onto the math sheet, science data onto science sheet, and engnlish data onto english sheet. This is a simplified version, as my real example has 140 different "subjects" and about 40,000 rows, so doing it manually is a bit out of the question. Let me know if any of that didnt make sense or if i can further clarify. Thanks, James |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Copy data to multiple sheets | Excel Worksheet Functions | |||
How do I copy and move selections of data to other sheets? | Excel Worksheet Functions | |||
copy data from various sheets into one sheet | Excel Worksheet Functions | |||
copy data between sheets, but not the formula | Excel Worksheet Functions | |||
in VBA Sheets("mysheet").Copy Befo=Sheets(1) how do i get a reference to the newly created copy of this sheet? | Excel Worksheet Functions |