Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Macro using SendKeys

Posted on 2014-11-24
9
Medium Priority
?
101 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 49

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 49

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
Industry Leaders: 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 49

Accepted Solution

by:
Martin Liss earned 2000 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 49

Expert Comment

by:Martin Liss
ID: 40463248
YW U2
0

Featured Post

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Question has a verified solution.

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

Excel can be a tricky bit of software to get your head around. Whilst you’ll be able to eventually get to grips with the basic understanding of how to get by, there are a few Excel tips that not everybody will even know about let alone know how to d…
This article describes a serious pitfall that can happen when deleting shapes using VBA.
The viewer will learn how to create a normally distributed random variable in Excel, use a normal distribution to simulate the return on an investment over a period of years, Create a Monte Carlo simulation using a normal random variable, and calcul…
This Micro Tutorial demonstrates how to create Excel charts: column, area, line, bar, and scatter charts. Formatting tips are provided as well.

972 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