Solved

Macro using SendKeys

Posted on 2014-11-24
9
87 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 46

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 46

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
Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

 

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 46

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 46

Expert Comment

by:Martin Liss
ID: 40463248
YW U2
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

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.
Some code to ensure data integrity when using macros within Excel. Also included code that helps secure your data within an Excel workbook.
This Micro Tutorial demonstrates how to create Excel charts: column, area, line, bar, and scatter charts. Formatting tips are provided as well.
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.

792 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