Selection.Copy line not working on Mac

Mustang0710

New Member
Joined
Mar 4, 2015
Messages
16
I have a large macro that creates reference columns based on other data in the workbook. This macro is working fine on a Windows PC, but is giving me issues on the Mac version of Excel.

Section of code:
Range("O2").Select 'Enter formula on first cell
Cells(2, 15) = "=IF(ISERROR(VLOOKUP($B2,$S$2:$S$50000,1,FALSE)),"""",""Yes"")"
Range("O2:O" & NLastRow).Select
Selection.FillDown 'Copy down through all nodes
Selection.Copy
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:=False, Transpose:=False 'Debug MAC
Application.CutCopyMode = False

The Selection.Copy command does not appear to do anything, so when it tries the Selection.PasteSpecial line, it receives and error because nothing has been copied.

Thank you very much for your help.
 

Excel Facts

Will the fill handle fill 1, 2, 3?
Yes! Type 1 in a cell. Hold down Ctrl while you drag the fill handle.
Try
Code:
With Range("O2:O" & NLastRow)
    .FormulaR1C1 = "=IF(ISERROR(VLOOKUP(RC2,R2C19:R50000C19,1,FALSE)),"""",""Yes"")"
    .Value = .Value
End With
 
Upvote 0
Thank you...thank you

That works great and accomplishes the same function. Now I just need to find all the places where I use FillDown, Copy and PasteSpecial to replace the code.
I appreciate the quick response

This site is fantastic!
 
Upvote 0
Since you were using PasteValues, you don't need to Copy. You need to make the values of the target range the same as the values of the source range.

code like

Code:
Range("G2:J5").Value = Range("A1:D4").Value

is much faster, and less prone to crashing, than

Code:
Range("A1:D4").Copy destination:=Range("G2:J5")


And, I can't replicate the error you mention in the OP, the OP code works fine for me on my Mac (Excel 2011)
 
Upvote 0
All for making it the most efficient.

Yeah, I have a few hundred PC users using these macros and less than a dozen on Mac. However, I noticed that the Mac users (different Mac OS or Excel version) get different errors. I was able to fix some and I hope this will fix the remaining ones.

Thank again for all your help!!!
 
Upvote 0

Forum statistics

Threads
1,223,228
Messages
6,170,871
Members
452,363
Latest member
merico17

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