What is wrong with this vba code

dpaton05

Well-known Member
Joined
Aug 14, 2018
Messages
2,392
Office Version
  1. 365
  2. 2016
Platform
  1. Windows
Dim sht As Worksheet


Set sht = ActiveSheet

Sheets("sheet2").Shapes("ImgG").Copy
Sheets("NPSS_quote_sheet").Paste _
Destination:=Worksheets("NPSS_quote_sheet").Range("sht.Cells.SpecialCells(xlCellTypeLastCell).Row"+4)

I have a worksheet, NPSS_quote_sheet that I need to paste a signature I have saved on sheet2, 4 lines below the last cell. Could someone help me with this code please as I tried putting a method for finding the last cell into the range but as I don't know how to code, I can't debug it.

Thanks,
Dave
 

Excel Facts

Wildcard in VLOOKUP
Use =VLOOKUP("Apple*" to find apple, Apple, or applesauce
See if this works for you.
Code:
Option Explicit


Sub foo()
Dim sht As Worksheet
Set sht = ActiveSheet
Dim lr As Long
'Find the last used row in Column A of target.  Change column as required
lr = Sheets("NPSS_quote_sheet").Range("A" & Rows.Count).End(xlUp).Row
Sheets("sheet2").Shapes("ImgG").Copy
Sheets("NPSS_quote_sheet").Paste _
Destination:=Worksheets("NPSS_quote_sheet").Range("A" & lr + 4)
End Sub
 
Upvote 0
That works GREAT, thanks!!

Is there a way to not just check the last value in column A, but the last value in any column as it might not be in column A the notes are written?
 
Upvote 0
How do you make the image snap to 1 page if it is inserted at the bottom of the page and it is half on one page and the other half of the image is on the other page?
 
Upvote 0
Thanks for that Alan. Do you know how to get images to snap to a page?
 
Upvote 0
Have no idea. Best chance for an answer is to start a new thread with a clear succinct title.
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,181
Members
453,022
Latest member
Mohamed Magdi Tawfiq Emam

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