VBA in MS 365 not running on Windows 10 version

normpam

Active Member
Joined
Oct 30, 2002
Messages
296
When I run my program which includes the following code on my Office 365 version it works just fine. Does not work on any version with Windows 10 or Windows 7. When run on the other computers it errors out and highlights in yellow the code below that is in red font.

Was there an update which 'canceled' this code syntax, and if so, what can be used that will work on a non-Office 365 version?

Program code:
customer = Range(ActiveCell, ActiveCell).Value
Range("P2").CurrentRegion.Name = "CustList"
Range("CustList").Select
Selection.Find(What:=customer, After:=ActiveCell, LookIn:=xlFormulas2, LookAt _
:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:= _
False, SearchFormat:=False).Activate
 

Excel Facts

What is =ROMAN(40) in Excel?
The Roman numeral for 40 is XL. Bill "MrExcel" Jelen's 40th book was called MrExcel XL.

Marc L

Well-known Member
Joined
Apr 5, 2021
Messages
1,623
Office Version
  1. 2010
Platform
  1. Windows
Remove the '2' of 'xlFormulas2' …​
You must see the VBA example of Range.Find method for how to check if something is found​
as your code as it is (from Macro Recorder and not cleaned) obviously raises an error when nothing is matching …​
 

normpam

Active Member
Joined
Oct 30, 2002
Messages
296
Thanks much! Seems to work ( I also turned on the Developer option in ribbons - not sure if that had something to do with it. Anyway, how do you guys get to know this stuff?!
 

Marc L

Well-known Member
Joined
Apr 5, 2021
Messages
1,623
Office Version
  1. 2010
Platform
  1. Windows
Just using classic Excel versions - nothin' to do in fact with Windows 10 or Seven ! - where this VBA constant does not exist …​
 

Forum statistics

Threads
1,144,572
Messages
5,725,071
Members
422,590
Latest member
Mikeyyy

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
Top