Copy Only Values

klatlap

Well-known Member
Joined
Sep 1, 2004
Messages
607
Office Version
  1. 2013
Platform
  1. Windows
I only want to copy the values when using this macro.

Code:
Sub secondleg()

FindItem = Sheets("Results").Range("T2").Value

On Error Resume Next
FoundItem = Sheets("Results").Range("H3:H65535").Find(What:=FindItem).Address
On Error GoTo 0

If FoundItem <> "" Then
    PasteLocation = Sheets("Results").Range(FoundItem).Offset(0, 15).Address

    Sheets("Results").Range("V2:AA2").Copy Sheets("Results").Range(PasteLocation)
    
End If

End Sub
 

Excel Facts

Format cells as time
Select range and press Ctrl+Shift+2 to format cells as time. (Shift 2 is the @ sign).
Hello Klatlap,

Assuming that your code does work, a slight amendment as follows should do the task for you:-

VBA Code:
Sub secondleg()

FindItem = Sheets("Results").Range("T2").Value

On Error Resume Next
FoundItem = Sheets("Results").Range("H3:H65535").Find(What:=FindItem).Address
On Error GoTo 0

If FoundItem <> "" Then
    PasteLocation = Sheets("Results").Range(FoundItem).Offset(0, 15).Address

    Sheets("Results").Range("V2:AA2").Copy
    Sheets("Results").Range(PasteLocation).PasteSpecial xlValues
    
End If

End Sub

I hope that this helps.

Cheerio,
vcoolio.
 
Upvote 0
Cheers, i knew it would be something similar in that last line i just couldn't get it right, worked perfectly.
 
Upvote 0
You're welcome Klatlap. I'm happy to have been able to assist.

Cheerio,
vcoolio.
 
Upvote 0

Forum statistics

Threads
1,215,096
Messages
6,123,074
Members
449,093
Latest member
ripvw

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