Copy & Paste Values In Next Column From B2

outlook

Board Regular
Joined
Jun 16, 2010
Messages
93
Hi All,

I have two worksheets:

"Pipeline"
"Weekly Pipelines"

I need to copy data from B1 to B4 on "Pipeline" and paste values to the next available column after B2 in "Weekly Pipelines".

Would anybody be able to help me with the code as I have tried lots of different codes, and nothing seems to work exactly how I need it to.

Thank you so much! :)
 

Excel Facts

What did Pito Salas invent?
Pito Salas, working for Lotus, popularized what would become to be pivot tables. It was released as Lotus Improv in 1989.
Assuming that you really did mean next available column (not row) try

Code:
Sub test()
Dim LC As Integer
LC = Sheets("Weekly Pipelines").Cells(2, Columns.Count).End(xlToLeft).Column + 1
Sheets("Pipeline").Range("B1:B4").Copy Destination:=Sheets("Weekly Pipelines").Cells(2, LC)
End Sub
 
Upvote 0
I definately meant next column.

Thank you for the code, it's works a treat.

The only problem I have now is that it's posting the formular that I have in B1:B4, and not values.

Can this be done?

Thank you.
 
Upvote 0
Sorry, I missed the values part. Try

Code:
Sub test()
Dim LC As Integer
LC = Sheets("Weekly Pipelines").Cells(2, Columns.Count).End(xlToLeft).Column + 1
Sheets("Pipeline").Range("B1:B4").Copy
Sheets("Weekly Pipelines").Cells(2, LC).PasteSpecial Paste:=xlPasteValues
End Sub
 
Upvote 0
Would you be able to help me further ...

If I wanted something similar for another worksheet, but for rows instead, would I just change "LC" to "LR" and "Columns" to "Rows"?

Thanks, again!
 
Upvote 0
It is easier with rows. For example

Code:
Sub test2()
Sheets("Pipeline").Range("B1:B4").Copy
Sheets("Weekly Pipelines").Range("A" & Rows.Count).End(xlUp).Offset(1).PasteSpecial Paste:=xlPasteValues
End Sub
 
Upvote 0
Sorry to be a pain, but would this still work if one of the worksheets was in another workbook? If so, how?

Thanks.:)
 
Upvote 0
With both workbooks open

Code:
Sub test2()
Workbooks("Book1.xls").Sheets("Pipeline").Range("B1:B4").Copy
Workbooks("Book2.xls").Sheets("Weekly Pipelines").Range("A" & Rows.Count).End(xlUp).Offset(1).PasteSpecial Paste:=xlPasteValues
End Sub
 
Upvote 0

Forum statistics

Threads
1,214,911
Messages
6,122,194
Members
449,072
Latest member
DW Draft

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