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:

Some videos you may like

Excel Facts

When they said...
When they said you are going to "Excel at life", they meant you "will be doing Excel your whole life".

fredrerik84

Active Member
Joined
Feb 26, 2017
Messages
383
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?
 

Watch MrExcel Video

Forum statistics

Threads
1,108,619
Messages
5,523,940
Members
409,543
Latest member
LaMaqu1na

This Week's Hot Topics

Top