VBA Code to copy a range that differs for each sheet and pastes it in a new sheet

%3CLINGO-SUB%20id%3D%22lingo-sub-3015205%22%20slang%3D%22en-US%22%3EVBA%20Code%20to%20copy%20a%20range%20that%20differs%20for%20each%20sheet%20and%20pastes%20it%20in%20a%20new%20sheet%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3015205%22%20slang%3D%22en-US%22%3E%3CP%3EI%20am%20trying%20to%20write%20a%20VBA%20code%20to%20copy%20data%20from%20sheet%20%22Data1%22.%20I%20need%20to%20copy%20data%20from%20C3%20and%20down%20to%20the%20end%20(the%20end%20differs%20every%20time)%2C%20then%20create%20a%20new%20sheet%20titled%20%22Graph%22%20and%20paste%20the%20data%20into%20cell%20A2%20and%20down.%20The%20same%20needs%20to%20be%20done%20from%20B3%20and%20down%20to%20the%20same%20end%20and%20then%20pasted%20into%20the%20%22Graph%22%20worksheet%20into%20cell%20E2.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThe%20data%20in%20the%26nbsp%3Bimage%20titled%20%22Data1%20Worksheet%22%20is%20how%20the%20data%20is%20obtained.%20The%20data%20in%20the%20image%20titled%20%22Graph%20Worksheet%22%20is%20how%20I%20need%20it%20to%20end%20up%20after%20copying%20the%20data%20and%20inserting%20it%20into%20cells%20A2%20and%20E2.%20Also%2C%20how%20could%20I%20make%20it%20automatically%20populate%20that%20top%20row%20when%20it%20creates%20the%20%22Graph%22%20Worksheet%3F%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThank%20you%20so%20much%20for%20the%20help!%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22Graph%20Worksheet.PNG%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F330080i77C20220E23AEFAB%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22Graph%20Worksheet.PNG%22%20alt%3D%22Graph%20Worksheet.PNG%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22Data1%20Worksheet.PNG%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F330079i18793BF10A8A0955%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22Data1%20Worksheet.PNG%22%20alt%3D%22Data1%20Worksheet.PNG%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-3015205%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EExcel%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EMacros%20and%20VBA%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E
Occasional Visitor

I am trying to write a VBA code to copy data from sheet "Data1". I need to copy data from C3 and down to the end (the end differs every time), then create a new sheet titled "Graph" and paste the data into cell A2 and down. The same needs to be done from B3 and down to the same end and then pasted into the "Graph" worksheet into cell E2.

 

The data in the image titled "Data1 Worksheet" is how the data is obtained. The data in the image titled "Graph Worksheet" is how I need it to end up after copying the data and inserting it into cells A2 and E2. Also, how could I make it automatically populate that top row when it creates the "Graph" Worksheet?

 

Thank you so much for the help!

Graph Worksheet.PNG

Data1 Worksheet.PNG

0 Replies