-
Run-time error 91
Hi,
I am not experienced at all when it comes to excel and VB, but I am working in a Excel sheet inserted into a pp where I need to record a macro for a simple "sort list" execution (this is meant for people in my organization to enter info and then be able to click a button to sort the info they have entered).
Now, when I am recording the macro it works fine while I keep the document opened - but as save the pp presentation and close the excel sheet and the pp presentation and open it up again the macro does not work. The text saying this comes up:
"Cannot run the macro"worksheet in Segmentation HW Acc 2010 V8.1(Compability Mode)'!sortlist'. The macro may not be available in this worksheet or all macros may be disabled."
When I look into the module and debug it says:
Code:
Sub sortlist()
'
' sortlist Macro
'
'
ActiveWorkbook.Worksheets("Sheet1").AutoFilter.Sort.SortFields.Clear
ActiveWorkbook.Worksheets("Sheet1").AutoFilter.Sort.SortFields.Add Key:=Range _
("C3:C46"), SortOn:=xlSortOnValues, Order:=xlDescending, DataOption:= _
xlSortNormal
With ActiveWorkbook.Worksheets("Sheet1").AutoFilter.Sort
.Header = xlYes
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
End Sub
I would be so happy to get some help on this, since I am not that experienced and it is not easy for me to understand. Thank you all!:confused:
-
Re: Run-time error 91
Moved To Office Development
-
Re: Run-time error 91
Welcome to the forums :wave:
Please help us with two things.
1) Which Excel and PP version are you using?
2) Can you attach a sample file/snapshot of the error?
-
Re: Run-time error 91
Sounds like Macros may be disabled. Go to Tools > Macro > Security and set the level to Meduim. This will allow you to choose to run macros or not when the office app is run. If you have 2007 or newer then its in the Office button > Options.
Also, why is it in "Compatibility Mode"?