rkscroggins
New Member
Hello, I am trying to create a macro that will extract data from one sheet to another in multiple rows referencing a value in column B. I've attached a condensed version of my file.
I need a macro that will basically do the same thing as a VLookup / XLookup, referencing column B in both sheets, and dump the data into multiple columns. The columns are labeled; the columns labeled "tracker" are not extracted from the project data sheet and can therefore be skipped over.
I need the format, font, borders, etc in the sheet titled "Master" to remain the same. The data in sheet "Project Data" is extracted from a database and is therefore raw data. Ideally I would download new raw data each morning, run a macro to extract that data into "Master" corresponding with columns B.
I have written one successful code, but it merely copies data in order by row. It does not reference columns B and therefore the data is not accurate to each row.
I have written another code, but I continue to get an error and am stuck. I've pasted both codes below. Any help you can give me would be wonderful; I've spent hours going cross eyed over this.
First Code that doesn't reference column B:
>>> use code - tags <<<
Second code that returns error I have tried to manipulate the code many many times but it continues to return an error
I need a macro that will basically do the same thing as a VLookup / XLookup, referencing column B in both sheets, and dump the data into multiple columns. The columns are labeled; the columns labeled "tracker" are not extracted from the project data sheet and can therefore be skipped over.
I need the format, font, borders, etc in the sheet titled "Master" to remain the same. The data in sheet "Project Data" is extracted from a database and is therefore raw data. Ideally I would download new raw data each morning, run a macro to extract that data into "Master" corresponding with columns B.
I have written one successful code, but it merely copies data in order by row. It does not reference columns B and therefore the data is not accurate to each row.
I have written another code, but I continue to get an error and am stuck. I've pasted both codes below. Any help you can give me would be wonderful; I've spent hours going cross eyed over this.
First Code that doesn't reference column B:
>>> use code - tags <<<
Code:
Sub Extract_Data_from_One_Sheet_to_Another()
Sheets("Project Data").Range("I2:I500").Copy
Sheets("Master").Range("E3:E501").PasteSpecial xlPasteFormulasAndNumberFormats
Sheets("Project Data").Range("BX2:BX500").Copy
Sheets("Master").Range("F3:F501").PasteSpecial xlPasteFormulasAndNumberFormats
End Sub
Second code that returns error I have tried to manipulate the code many many times but it continues to return an error
Code:
Sub CrownWest()
Application.ScreenUpdating = False
Dim i, j As Long
j = Sheets("Master").Range("B3:B501")
i = Sheets("Project Data").Range("B2:B500")
Application.WorksheetFunction.VLookup(Range("B3:B501"), Sheets("Master"), (Range("B2:B500")), Sheets("Project Data"), 0) = 1
Sheet2.Range("I2:I").Copy
Sheet1.Range("E3:E501" & i).PasteSpecial xlPasteFormulasAndNumberFormats
Sheet2.Range("BX2:BX").Copy
Sheet1.Range("F3:F501" & i).PasteSpecial xlPasteFormulasAndNumberFormats
Application.CutCopyMode = False
Application.ScreenUpdating = True
End Sub
Attachments
Last edited by a moderator: