2007 excel to 2003 compatibility issue - runtime 935 error

mook25

New Member
Joined
Jul 30, 2013
Messages
9
Hi, I have a VBA script which is to run a formula from another sheets cell so as to conditionally format cells on another sheet however the script was written in excel 2007 and i am restricted to excel 2003.

Because of this i'm getting the runtime error 935 which i'm told is down to the compatability issue beteween the 2 versions of excel. I know there are work arounds but i am not a VBA expert. Can anyone help? Thanks

Code:
Sub SetConditional()</SPAN>
   
    With Selection</SPAN>
      .FormatConditions.Add Type:=xlExpression, Formula1:=ActiveWorkbook.Sheets("Sheet1").Range("A1").Formula</SPAN>
      .FormatConditions(Selection.FormatConditions.Count).SetFirstPriority</SPAN>
      With .FormatConditions(1).Interior</SPAN>
        .Pattern = xlSolid</SPAN>
        .PatternColorIndex = xlAutomatic</SPAN>
        .ColorIndex = xlAutomatic</SPAN>
      End With</SPAN>
      .FormatConditions(1).StopIfTrue = False</SPAN>
    End With</SPAN>
   
End Sub</SPAN>
 

Excel Facts

Pivot Table Drill Down
Double-click any number in a pivot table to create a new report showing all detail rows that make up that number
Try removing these two lines:
Code:
.FormatConditions(Selection.FormatConditions.Count).SetFirstPriority
and
Code:
      .FormatConditions(1).StopIfTrue = False
 
Upvote 0
On which line? It works for me in 2003 (assuming you have a Sheet1)
 
Upvote 0
Ok i did mess up a bit there and was changing the range thinking it was the sheet name.....it's been a long day. lol

I have corrected and now get the runtime error 1004 - Application defined or object defined error' when accessing debug it highlights the line below.

Code:
.FormatConditions.Add Type:=xlExpression, Formula1:=ActiveWorkbook.Sheets("Sheet1").Range("A1").Formula

could you paste your version after edits here, if it works for you, just in case i'm missing something?

Thanks
 
Upvote 0
My version is the same. You would get an error if you already had three formats in place in 2003, or if the formula in A1 wasn't valid.
 
Upvote 0
There is defo no other formats in place and as far as i am aware the formula is correct. I think i'll try to get an updated version of excel at home and forward on from work to home and try again there to see if i can correct the problem. Thanks for your help though.
 
Upvote 0

Forum statistics

Threads
1,223,238
Messages
6,170,939
Members
452,368
Latest member
jayp2104

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