What is wrong with this vba code

dpaton05

Well-known Member
Joined
Aug 14, 2018
Messages
2,362
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

Lock one reference in a formula
Need 1 part of a formula to always point to the same range? use $ signs: $V$2:$Z$99 will always point to V2:Z99, even after copying
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,223,231
Messages
6,170,884
Members
452,364
Latest member
springate

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