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

Why are there 1,048,576 rows in Excel?
The Excel team increased the size of the grid in 2007. There are 2^20 rows and 2^14 columns for a total of 17 billion cells.
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,215,459
Messages
6,124,948
Members
449,198
Latest member
MhammadishaqKhan

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