Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

I need to click button and then print text on Sheet ? 1

Status
Not open for further replies.

Recce

Programmer
Aug 28, 2002
425
ZA
Good day,

I wrote the below code to refresh the Pivot Table on my Excel worksheet and to then print the time on the same sheet however,I can not seem to activate the sheet in order to print the time after I clicked the button on the sheet. How would I do that ?

[pipe] "We know nothing but, that what we know is not the truth..." - Me
 

Why not add the time field on header/footer at page setup..
 
Guys, thx for the reply and sorry about the code that I forgot :)

Private Sub MyButton_Click()

Dim MyTime
MyTime = Time

ActiveSheet.PivotTables("PivotTable1").RefreshTable

Range("A3").Select
ActiveCell.FormulaR1C1 = "Last refreshed @" & " " & MyTime
Range("B3").Select

End Sub


[pipe] "We know nothing but, that what we know is not the truth..." - Me
 
You may try this:
With ActiveSheet.PivotTables("PivotTable1").PivotCache
.BackgroundQuery = False
.Refresh
End with

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Nice one ! I Like it ! Thanks PHV, it works great !

[pipe] "We know nothing but, that what we know is not the truth..." - Me
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top