Help to adjust this code slightly!

Solved/Closed
Report
-
 Nicklt -
Hello,

I have this code,

Sub IMPORT()
Dim NextRow As Long

Sheets("New & Renewals").Range("A4:D4").Copy

NextRow = Sheets("Approved & Completed").Range("A" & Rows.Count).End(xlUp).Row + 1

Sheets("Approved & Completed").Range("A" & NextRow).PasteSpecial Paste:=xlPasteValues

End Sub


The part in bold "A4:D4" i want this to actually be what the User has currently highlighted, so in other words what the user has currently selected on the worksheet.

Thanks.

.


3 replies

Posts
4476
Registration date
Thursday January 28, 2010
Status
Contributor
Last seen
August 2, 2020
768
See if this works


Sheets("New & Renewals").selection.Copy
0
Hi Rizvisa, i replaced Sheets("New & Renewals").Range("A4:D4").Copy with you suggestion and got a Runtime Error: 438

Anymore suggestions greatly welcome.
0
Posts
4476
Registration date
Thursday January 28, 2010
Status
Contributor
Last seen
August 2, 2020
768
Could you please upload a sample EXCEL file WITH sample data, macro, formula , conditional formatting etc on some shared site like https://authentification.site , http://docs.google.com, http://wikisend.com/ , http://www.editgrid.com etc
A N D post back here the link to allow better understanding of how it is now and how you foresee. Based on the sample book, could you re-explain your problem too

Also please write a couple of lines on how to use your macro and how to re-create your issue (please list steps for I am a dummy)
0
Hi, it's ok i have worked it out, it was simply Selection.Copy
0