Need a Code for Pasting in last row after current data

AV_Geek

New Member
Joined
Jan 23, 2022
Messages
32
Office Version
  1. 365
Platform
  1. MacOS
I'm looking for a code to Copy a Formula from "Sheet2" Cell "B5" and paste it into "Sheet1" the range from Column B through the last column in the row below the current last row

For example: If my Data in Sheet1 is A1:F25, I'd like this formula pasted in B26:F26
 

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.
Try:
VBA Code:
Sheets("Sheet2").Range("B5:F5").Copy Sheets("Sheet1").Cells(Sheets("Sheet1").Rows.Count, "B").End(xlUp).Offset(1, 0)
 
Upvote 0
Well, it half works. it pasts into the correct row, but only pastes into Column B.

Keep in mind, on Sheet2, I'm only copying one cell. I want to paste that formula across the bottom of Sheet1
 
Upvote 0
Solved

VBA Code:
Sheets("Sheet2").Select
    Range("Y21").Select
    Selection.Copy

Sheets("Sheet1").Select
lastrow = Cells.Find(What:="*", LookIn:=xlValues, SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row
lastcol = Cells.Find(What:="*", LookIn:=xlValues, SearchOrder:=xlByColumns, SearchDirection:=xlPrevious).Column
Range(Cells(lastrow, 2), Cells(lastrow, lastcol)).Offset(1, 0).Select

ActiveSheet.Paste
 
Upvote 0

Forum statistics

Threads
1,223,228
Messages
6,170,871
Members
452,363
Latest member
merico17

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