vba excel - functions
The UK's Number 1 for Microsoft Office Training Add this page to your favourites/bookmarksBookmark page
 
View printable version of pagePrintable version
Plus One Google
Customer: Sign in
Delegate: Sign in
Trainer: Log in

Forum home » Delegate support and help forum » Microsoft Excel Training and help » vba excel - Functions

vba excel - Functions

resolvedResolved · Low Priority · Version Standard

replyReply Fri 14 Sep 2007, 16:30Delegate Andy said...

Andy has attended:
Access Introduction course
Excel VBA Intro Intermediate course

Functions

Pivot tables

For upcoming training course dates see: Pricing & availability

replyReply Mon 1 Oct 2007, 13:44Trainer Carlos said...

RE: Functions

Andy

Below is the code to create a pivot table in VBA

====================

Sub CreatePivot()

Dim DataRange As Range
Dim Destination As Range
Dim PvtTable As PivotTable

Set Destination = Sheets("Sales Summary").Range("A12")
Set DataRange = Range("A9", Range("J9").End(xlDown))

ActiveSheet.PivotTableWizard SourceType:=xlDatabase, _
SourceData:=DataRange, TableDestination:=Destination, TableName:="SalesInfo"

Application.CommandBars("PivotTable").Visible = False 'Hides toolbar
ActiveWorkbook.ShowPivotTableFieldList = False 'Hides Field List

Set PvtTable = Sheets("Sales Summary").PivotTables("SalesInfo")

With PvtTable
.PivotFields(

 

Excel tip:

Do a fast scroll

In big Excel databases with many records, you can move down thousands of rows super-fast as follows: hold down Shift then click on the scrollbar somewhere below the scrollbar handle. This will move you way down the sheet without your having to use the scrollbar up/down arrows or drag on the scrollbar handle.

View all Excel hints and tips


Microsoft Certified Partner Accredited Training Provider: Institute of IT Training Institute of Leadership and Management - Certified Courses Security Seal verified by visa, mastercard securecard