Paste Right Below Specific Cell

samuelm

New Member
Joined
Mar 23, 2023
Messages
3
Office Version
  1. 365
Platform
  1. Windows
Hello,

I am trying to paste directly one row below the specific cell on the "Paste" sheet that equals the value from another sheet (Planning). My code has been functional, but sporadically and I often get reference errors. Both of these cells will contain formulas, so the fnd needs to account for that and I think that might be my issue. Note that the macro would be run from a third sheet (which also seems to be causing issues, I believe my references are off. )

VBA Code:
[FONT=Calibri]Sub Paste()
 
 Set inputsheet = ThisWorkbook.Sheets("Paste")
 
 fnd = Worksheets("Planning").Range("B3").Value
 Set myRange = inputsheet.UsedRange
 Set LastCell = myRange.Cells(myRange.Cells.Count)
 Set foundCell = myRange.Find(What:=fnd, After:=LastCell)
 
Set Rng = foundCell
 
 Set Rng = Rng.Offset(1, 0)
 Rng.PasteSpecial Paste:=xlPasteValues

End Sub[/FONT]
 

Excel Facts

What does custom number format of ;;; mean?
Three semi-colons will hide the value in the cell. Although most people use white font instead.
Hi,
Easier than pasting values ...
VBA Code:
foundcell.Offset(1, 0).Value = foundcell.Value
 
Upvote 0

Forum statistics

Threads
1,223,236
Messages
6,170,906
Members
452,366
Latest member
TePunaBloke

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