Insert data from one worksheet into another

Devotchka

New Member
Joined
Jun 8, 2010
Messages
13
I have two worksheets Star and Atlas. These two worksheets get updated daily so the number of rows change, but all the columns stay the same. There is information in Star that starts in column P2 and ends at a different place depending on the day the data is imported. What I need is to insert from Star P2 to Atlas column Q first blank cell. I need it to keep repeating until all the information from column P (starting at P2) is inserted. Please please help! I would greatly appreciate it.

Thank you.
 

Excel Facts

Which came first: VisiCalc or Lotus 1-2-3?
Dan Bricklin and Bob Frankston debuted VisiCalc in 1979 as a Visible Calculator. Lotus 1-2-3 debuted in the early 1980's, from Mitch Kapor.
Try

Code:
Sub CopyP()
Dim LR As Long
With Sheets("Star")
    LR = .Range("P" & Rows.Count).End(xlUp).Row
    .Range("P2:P" & LR).Copy Destination:=Sheets("Atlas").Range("Q" & Rows.Count).End(xlUp).Offset(1)
End With
End Sub
 
Upvote 0
Thank you for such a quick reply! I tried opening a new blank sheet and typed in your code and it works perfect, but for some reason when I use it with my existing file it refuses to work. Nothing happens! Does the order of the tabs matter?
 
Upvote 0
Assuming that columns P and Q have the same number of rows try

Code:
Sub CopyP()
Dim LR As Long
With Sheets("Star")
    LR = .Range("P" & Rows.Count).End(xlUp).Row
    .Range("P2:P" & LR).Copy Destination:=Sheets("Atlas").Range("Q" & Rows.Count).End(xlUp).Offset(1)
    .Range("Q2:Q" & LR).Copy Destination:=Sheets("Atlas").Range("O" & Rows.Count).End(xlUp).Offset(1)
End With
End Sub
 
Upvote 0
I'm sorry for asking so many questions, but I have one little problem. Some of the cells I'm "copying" from Star are VLOOKUPs and since they're formulas they show up in Atlas as "#N/A" How can I do a paste special as values instead?
 
Upvote 0
Try this

Code:
Sub CopyP()
Dim LR As Long
With Sheets("Star")
    LR = .Range("P" & Rows.Count).End(xlUp).Row
    .Range("P2:P" & LR).Copy
    Sheets("Atlas").Range("Q" & Rows.Count).End(xlUp).Offset(1).PasteSpecial Paste:=xlPasteValues
    .Range("Q2:Q" & LR).Copy
    Sheets("Atlas").Range("O" & Rows.Count).End(xlUp).Offset(1).PasteSpecial Paste:=xlPasteValues
End With
End Sub
 
Upvote 0

Forum statistics

Threads
1,214,786
Messages
6,121,548
Members
449,038
Latest member
Guest1337

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top