Macro works on 365 but not 2010

Dazzawm

Well-known Member
Joined
Jan 24, 2011
Messages
3,748
Office Version
  1. 365
Platform
  1. Windows
I have a macro that works fine on my 365 and a colleagues also. Another colleague that has Office 2010 and when he runs it it comes up with Compile error: Syntax error.

Is this common? Do macros work on some office versions but not others?

Any help appreciated.
 
Add2 will not work in 2010.
Thanks for confirming that, Rory.
I was pretty sure that was the case, but no longer have access to Excel 2010 to confirm.
 
Upvote 0

Excel Facts

Did you know Excel offers Filter by Selection?
Add the AutoFilter icon to the Quick Access Toolbar. Select a cell containing Apple, click AutoFilter, and you will get all rows with Apple
It won't work in 2016 or earlier either.
 
Upvote 0
I think I changed to Add anyway which threw up another overflow error which made me think about the integer and long.
It is important to understand how big your variables may get, and the limitations of each variable type, so as to not run into problems.
See here: Data type summary

When using a variable to store something like row number, I always use "Long" as that is big enough to handle any row number on the sheet, while "Integer" would only handle up to 32,767, as Excel has more rows than that.
 
Upvote 0

Forum statistics

Threads
1,214,932
Messages
6,122,332
Members
449,077
Latest member
jmsotelo

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