LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default VBA in Excel for Pivot Table Selection (want to use a variable)

I've got a listbox with a location selection which I'd like the user
to use. The user will select the a specific location name and this
should access the pivot table (actually it's a cube) location field
and make the applicable selection in the pivot table.

This is what I have - not sure if I'm on the right track.

Sub LocListbox_Change()
'Select Location Name from Cube for Loc G&E
Dim LocNum As Int
Dim LocName As String
Application.ScreenUpdating = False
LocNum = Worksheets("ByLocGraphsExceptions").Range("R1")
Sheets("Tables").Activate
LocName = WorksheetFunction.VLookup(LocNum, Range("A1:B101"), 2,
False)
Worksheets("LocGeData").Select
ActiveSheet.PivotTables("PivotTable3").PivotFields ("[PickupLocationCode]").
_
CurrentPageName = "[PickupLocationCode].[All].LocName"
Worksheets("ByLocGraphsExceptions").Select
Application.ScreenUpdating = True

End Sub

So the idea is that I am trying to create a variable LocName from a
reference table I have which returns a string inline with how the
pivot table has the locations listed, then I want to select this
location from the pivot table using that variable name but how do i
make this work? Any ideas??

thanks

 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
2003 Excel Pivot table data selection bhudson Excel Discussion (Misc queries) 0 December 24th 09 05:41 PM
Set selection of Pivot Table using VBA [email protected] Excel Programming 6 March 12th 07 09:53 AM
How do I include an all tab in a pivot variable selection Userx Excel Discussion (Misc queries) 1 September 26th 05 01:03 PM
Pivot Table - Object variable or with block variable not set? George Nicholson[_2_] Excel Programming 1 April 16th 04 09:12 PM
Pivot Table - Multiple Pivot Field Selection Paul Mac.[_2_] Excel Programming 3 November 10th 03 01:13 PM


All times are GMT +1. The time now is 01:40 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"