Creating a Pivot Table with VBA

J

John Wicks

Hello All,

I've been trying to get this Pivot table to work but the formatting escapes
me. All the examples I see have seperate sheets listing duplicate entries in
a long list of items. I'm hoping to use a different approach. What I'd like
to see is a calendar with some drop-downs that a user could select to show
them the available times for say tutors with experience in CISC 310 - C
Programming etc... Or if the user selects a particular tutor show them the
available hours for that particular tutor etc... I know the only way to get
those drop-downs is a pivot table but they don't work with the setup I have.
Just point in the right direction please....

Here's the link on Google where the spread sheet is
http://spreadsheets.google.com/pub?key=pc4aynAglM0Q8cDLP8XPBEw

The sheets I'm wanting to use are:
1. Lab Schedule - This is where I'd like the pivot table info to be with a
listing of each tutors name in the time slot. I'd like drop-downs boxes for
class, tutor name and subject. Each would limit the data displayed in the
schedule.
2. Tutor Subject List - Has a sheet with a listing of subjects the tutor is
capable in.
3. Tutor Class List - Similar to above only with classes
4. Tutor Schedule - A Sheet with the available times for the tutor

I've got several named ranges set up and I've created a couple of VB macros
to create lists of the data in those ranges from the sheets.

Examples...

' Gives me a list like John Doe Class1 etc...
Sub ShowTutorClassList()
For Each c In Range("TutorClassX")
If c.Value = "x" Or c.Value = "X" Then
Debug.Print ActiveSheet.Cells(c.Row, 1).Value & " " &
ActiveSheet.Cells(1, c.Column).Value
End If
Next c
End Sub

' Gives me a list like John Doe Subject1
Sub ShowTutorSubjectList()
For Each c In Range("TutorSubjectX")
If c.Value = "x" Or c.Value = "X" Then
Debug.Print ActiveSheet.Cells(c.Row, 1).Value & " " &
ActiveSheet.Cells(1, c.Column).Value
End If
Next c
End Sub

'Gives me a list like John Doe Monday 9:00am-9:30am
Sub ShowTutorScheduleList()
Dim vchName As String
For Each c In Range("TutorScheduleX")
If ((c.Column Mod 2 = 0) And (ActiveSheet.Cells(1, c.Column).Value
<> "")) Then
vchName = ActiveSheet.Cells(1, c.Column).Value
End If
If c.Value = "x" Or c.Value = "X" Then
Debug.Print vchName & " " & ActiveSheet.Cells(2, c.Column).Value
& " " & ActiveSheet.Cells(c.Row, 1).Value; ""
End If
Next c
End Sub

Now I just need to figure out the Pivot table code...

Thanks in advance for any guidance...

John
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top