vba copy value returns #N/A

martipe1

Board Regular
Joined
Mar 16, 2007
Messages
71
I'm trying to copy data and paste the values but when pasting formulas I get #N/A instead of the result of the formula.

The code to paste value:

ReporteWks.Range("A5:O" & rowsCopy).Value = rngCopy.Value

The formulas are a mix of several IFs with INDEX/Match, the results expected are either blank or a value, I have no problem with the formulas but I need to copy values, not formulas to another worksheet.

What can I do?

Thanks.
 

Excel Facts

Using Function Arguments with nested formulas
If writing INDEX in Func. Arguments, type MATCH(. Use the mouse to click inside MATCH in the formula bar. Dialog switches to MATCH.
What is the value if "rowsCopy"?
What range is "rngCopy" set to?

If you are doing multiple value cells at once, try using Copy --> Paste Special --> Values instead (can be done via VBA).
 
Upvote 0
Thank you for your answer.

rowsCopy = rngCopiy.Rows.Count
Set rngCopy = TempWks.Range("ReportDataCopy")

Named range
=OFFSET(Report!$AA$1,1,0,COUNTA(Report!$AK:$AK)-1,11)

As far as I know, the only at to paste special within is to set the target range value to range source value. is there another way?
 
Upvote 0
One way to do it is something like this:
VBA Code:
'   Select range to copy
    Sheets("Sheet1").Range("C1:C3").Copy

'   Go to next sheet
    Sheets("Sheet2").Select
    
'   Select first cell to paste to and paste values
    Range("G1").PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False
I documented the code to tell you what each of the three steps does.
You can substitute range variables for any of the ranges used in the code.
 
Upvote 0
Your RngCopy is only 11 columns wide, but you are trying to copy that to a range 15 columns wide.
 
Upvote 0
Solution
Glad we could help & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,214,990
Messages
6,122,626
Members
449,094
Latest member
bsb1122

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