Help with Excel macro [Closed]

Report
Posts
1
Registration date
Monday June 20, 2011
Status
Member
Last seen
June 20, 2011
-
Posts
261
Registration date
Saturday April 11, 2009
Status
Member
Last seen
June 21, 2011
-
Hello,

Hi. I am not a programmer and have not used Visual Basic before so that's probably my first problem (!) but I am trying to debug a macro in a workbook that a former colleague created and having no luck. The macro is designed to update values in a summary table based on various scenario inputs which are user created. That is, I fill out the specific data for one of six economic scenarios and then select which scenario I want to run, click on the macro and it updates the summary spreadsheet.

I believe the macro was created in an older version of Excel (?) but I'm not sure (I am running 2003 SP3). The error I get when I attempt to run the macro is "Run-time error '438' Object doesn't support this property or object"

When I go to debug to following code appears:
--------------------
Sub Macro4()
'
' Macro4 Macro
'

'
Range("D13:D18").Select
ActiveWorkbook.Worksheets("Scenario Assumptions").Sort.SortFields.Clear
ActiveWorkbook.Worksheets("Scenario Assumptions").Sort.SortFields.Add Key:= _
Range("D13:D18"), SortOn:=xlSortOnValues, Order:=xlAscending, DataOption _
:=xlSortNormal
With ActiveWorkbook.Worksheets("Scenario Assumptions").Sort
.SetRange Range("D13:D18")
.Header = xlGuess
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
End Sub

-------------------

The first row that starts with 'ActiveWorkbook' is highlighted in yellow.

I have searched online and tried various fixes but nothing is working. If anyone can see an obvious fix here I would be hugely grateful!!

Thanks

1 reply

Posts
261
Registration date
Saturday April 11, 2009
Status
Member
Last seen
June 21, 2011
307
Just check whether your workbook contains sheet named "Scenario Assumptions" check the spelling and spaces