Solved

Macro using SendKeys

Posted on 2014-11-24
9
88 Views
Last Modified: 2014-11-24
Folks,
I know of several ways to refresh data in a pivot table. The one I am interested in doing is a macro using SendKeys, "Alt + F5". Possible?
0
Comment
Question by:Frank Freese
  • 5
  • 4
9 Comments
 
LVL 47

Expert Comment

by:Martin Liss
ID: 40462846
What happens if you record a macro while doing it manually, undoing the change and then running the macro?
0
 

Author Comment

by:Frank Freese
ID: 40462860
I tried that and nothing was recorded.
I'm "thinking" this will work?

Sub UpdatePivot()

SendKeys "%{F5}"

End sub
0
 
LVL 47

Expert Comment

by:Martin Liss
ID: 40463004
Sure but (and I don't know much about pivot tables) would you need to add code to select the table?
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:Frank Freese
ID: 40463063
All the user has to do is click on the pivot table. I don't know how to select a pivot table vba, yet!?
0
 

Author Comment

by:Frank Freese
ID: 40463079
I can select a pivot table using vba - but the pivot table name would have to remain static and I'm not sure how that's going to hold up?
0
 
LVL 47

Accepted Solution

by:
Martin Liss earned 500 total points
ID: 40463145
This refers to the 1st pivot table on the sheet.

ActiveSheet.PivotTables(1).Name
0
 

Author Comment

by:Frank Freese
ID: 40463233
thanks Martin
Have a Happy Thanksgiving
0
 

Author Closing Comment

by:Frank Freese
ID: 40463235
thank you kindly sir
0
 
LVL 47

Expert Comment

by:Martin Liss
ID: 40463248
YW U2
0

Featured Post

MS Dynamics Made Instantly Simpler

Make Your Microsoft Dynamics Investment Count  & Drastically Decrease Training Time by Providing Intuitive Step-By-Step WalkThru Tutorials.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article will guide you to convert a grid from a picture into Excel format using Microsoft OneNote and no other 3rd party application.
Access developers frequently have requirements to interact with Excel (import from or output to) in their applications.  You might be able to accomplish this with the TransferSpreadsheet and OutputTo methods, but in this series of articles I will di…
This Micro Tutorial demonstrates in Microsoft Excel how to consolidate your marketing data by creating an interactive charts using form controls. This creates cool drop-downs for viewers of your chart to choose from.
This Micro Tutorial will demonstrate how to use a scrolling table in Microsoft Excel using the INDEX function.

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question