VBA Copy and Paste Cell Value Only - Not Formula

wguidry

New Member
Joined
Apr 22, 2003
Messages
42
I am having problems with the code listed below. The syntax is fine, but it returns a value of #N/A. The code copies a value from a second sheet and pastes it into the current sheet.

The cell being copied derives its value from a VLOOKUP function on a different sheet. I think this may be creating the problem.

Is there a way to copy a cell's numeric value only and not the formula? Or maybe paste the value only (like the Paste Special - Values Only menu item)?
---------------------------------------------
With Worksheets("Daily Calcs")
For i = 2 To 360
If Worksheets("Positions").Cells(i, 20).Value = "RED LINE" Then
Set rng6 = .Range("A3").End(xlDown).Offset(0, 41)
rng6.Copy
ActiveSheet.Paste Destination:=Worksheets("Positions").Range("W2")
End If
Next i
End With

Thanks,
Will
 
I'm no Pro, but If your Offset and Resize Values are the only values your routine will encounter, I would consolidate those into one, and then copy and .pastespecial .xlValue
ws1.Cells(I, 6).Copy
ws.Cells(9, 4).PasteSpecial xlPasteValues
Not sure if your realize, but the last post in this thread was from over 11 years ago, and the last poster hasn't been on this board in 10 years.
;)
 
Upvote 0

Excel Facts

Workdays for a market open Mon, Wed, Friday?
Yes! Use "0101011" for the weekend argument in NETWORKDAYS.INTL or WORKDAY.INTL. The 7 digits start on Monday. 1 means it is a weekend.
OK, but was I right?
What I am saying is that I doubt that the OP is still looking for assistance on it, since they haven't been active on the board for over 10 years!
 
Upvote 0

Forum statistics

Threads
1,215,087
Messages
6,123,050
Members
449,092
Latest member
ikke

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