Public Schedule Face-to-Face & Online Instructor-Led Training - View dates & book

excel macro

ResolvedVersion 2003

Hannes has attended:
No courses

Excel Macro

Hi,

I've recorded the following macro:

'''''''''''''''''''''''''''''''''''''''
Workbooks.Open Filename:= _
"C:\Data\Financial Planning Macro Building Project\A020 DEVELOPED MARKETS.xls"
Windows("Trans and Volumes.xls").Activate
Range("C7").Select

Sheets("Data Sheet").Select
Windows("A020 DEVELOPED MARKETS.xls").Activate

Application.Run "'A020 DEVELOPED MARKETS.xls'!MENU"
Application.Run "'A020 DEVELOPED MARKETS.xls'!ISSCTR"

Range("A4").Select
ActiveWorkbook.ShowPivotTableFieldList = True
ActiveSheet.PivotTables("PivotTable6").PivotFields("BRAND").CurrentPage = _
"MASTERCARD"
Range("BA23:BI24").Select
Selection.Copy
'''''''''''''''''''''''''''''''''''''''''''''''

My goal is once the macro is run to open antoher file and make changes on the pivot in that file and then to copy the result to the original file.

Everytime I run the macro it fails and show an error in the section which selects the pivot and changes the pivot fields.

I think this might have to do with the fact that the excel file is protected.

Any suggetions on how I can get this to run?

RE: Excel Macro

Hi Guys,

I found a way to buypass this issue with some creative programming.

Excel tip:

Create your own custom list on Excel 2010!

If you know how to use the auto-fill option on Excel then why not create your own customs lists?

The auto fill feature saves you time by allowing you to enter one of the list entries into a cell and then use your mouse to automatically drag the rest of the list into the cells below, above or to either side of the initial cell. When using your mouse to perform this task you will see a thin black cross appear at the bottom right hand side of the cell. Click, hold and drag to make the list appear.

Default lists include weekdays and months. To create your own list in Excel 2010 do the following;

>File
>Options
>Advanced
>Scroll right to the bottom of the page and you will see a buttom "edit custom lists", click this button
>enter your list in the list entries
>click add

Now try it out. Good luck.
>

View all Excel hints and tips

Connect with us:

0207 987 3777

Call for assistance

Request Callback

We will call you back

Server loaded in 0.1 secs.