VBA , Problem with automatic formula

fredrerik84

Active Member
Joined
Feb 26, 2017
Messages
383
Hi guys im currently on vacation and running my spreadsheet on a sub par laptop. On my workstation everything works great but after I started using it on win 7 32 bit on my laptop I have revived a bunch of errors when I run my sheet but I have fixed most of the problems but I get error with this code and I dont understand what might be wrong:

Any suggestions to how I can alter it so that it will work on my laptop:

Rich (BB code):
Sub BarMe(rng As Range)


    With Application
      .ScreenUpdating = False
   End With
   
    rng.Interior.ColorIndex = xlNone
    rng.FormatConditions.Add Type:=xlExpression, Formula1:="=MOD(ROW(),2)=0"
    rng.FormatConditions(1).Interior.Color = RGB(234, 234, 234)
    rng.FormatConditions.Add Type:=xlExpression, Formula1:="=MOD(ROW(),2)<>0"
    rng.FormatConditions(2).Interior.Color = RGB(255, 255, 255)
    
   With Application
      .ScreenUpdating = True
   End With
   
End Sub

I get error on this line
Rich (BB code):
rng.FormatConditions.Add Type:=xlExpression, Formula1:="=MOD(ROW(),2)=0"
any help would be much appreciated
 
Last edited:

Excel Facts

What is the last column in Excel?
Excel columns run from A to Z, AA to AZ, AAA to XFD. The last column is XFD.
I was not able to edit #1 but I think that the problem is that im running excel 2016 on my laptop , how can the above code be altered so that it works on excel 2016?
 
Upvote 0

Forum statistics

Threads
1,223,888
Messages
6,175,208
Members
452,618
Latest member
Tam84

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