LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #7   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 8,520
Default Copy data to different sheets

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
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
Copy data to multiple sheets HighlandRoss Excel Worksheet Functions 2 February 27th 08 08:38 PM
How do I copy and move selections of data to other sheets? JEZ838 Excel Worksheet Functions 1 November 3rd 06 03:38 PM
copy data from various sheets into one sheet vik Excel Worksheet Functions 2 April 14th 06 08:17 PM
copy data between sheets, but not the formula minxy11 Excel Worksheet Functions 1 March 28th 06 03:18 PM
in VBA Sheets("mysheet").Copy Befo=Sheets(1) how do i get a reference to the newly created copy of this sheet? Daniel Excel Worksheet Functions 1 July 6th 05 09:57 PM


All times are GMT +1. The time now is 08:07 AM.

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

About Us

"It's about Microsoft Excel"