Pulling data from sheet to mastersheet
I think I understand what you are saying but whatever you do, make a copy of
the spreadsheet before you try this. It's good advice whatever you do.
Name your master sheet Master and the other sheets as the department you
have on that sheet So if you have ED07 on sheet(2) then rename the sheet
ED07. The I think this should work, I haven't managed to test it because I
don't have the worksheet...
Sub Test()
Dim Dept As String, id As Integer, k As Long
For i = 1 To 3000 '3000 rows of data
Sheets("Master").Select
id = Cells(i, 1) 'sets id as cell column A row i which is id number
Dept = Cells(i, 4) 'sets Dept as Cell Column D Row i which is deptartment
Sheets(Dept).Select
Columns(1).Select 'Select id column
Cells.find(What:=id, After:=ActiveCell, LookIn:=xlFormulas, LookAt _
:=xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext,
MatchCase:= _
False).Activate
k = Range(ActiveCell).Row
Rows(k).Select
Selection.Copy
Sheets("Master").Select 'Master being the name of the master sheet number
Cells(i, 1).Select
ActiveSheet.Paste
Next
End Sub
Give it a go and let me know what happens...
--
Dave
"TooN" wrote:
Hello,
I hope somebody can help me with this problem, it will save me a lot of time.
I have a sheet that has about 3000 lines. Here is a small example of the
sheet:
(It has about 10 columns more)
Column A Column B Column C Column D
0001 0005 ED05
0002 0005 A940 ED05
0003 0006 ED05
0004 0006 E941 ED05
0005 0007 ED05
0006 0007 E943 ED05
0007 0008 ED07
0008 0008 K235 ED07
0009 0008 K240 ED07
0010 0008 K245 ED07
0011 0009 ED07
0012 0009 E495 ED07
0013 0011 ED07
0014 0011 E289 ED07
0015 0012 ED09
0016 0012 EK01 ED09
0017 0020 ED07
0018 0025 ED03
0019 0025 K430 ED03
0020 002B ED07
0021 002B E945 ED07
The 4th column are departments (ED05, ED09 etc). I have filtered the
mastersheet by department and copied the data to different sheets. Ive been
entering data in column 5 till 15 the last few weeks. The data that ive
entered is on the sheets that i filtered, not on the mastersheet (sheet1). I
would like to have a formula or a macro (even better) that copies the data to
the mastersheet. A reference would be column A because its a unique number (1
to 2834). Can you pleas help me out with this problem... thanks!
|