Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
URGENT! How to read value in pivot table
Hi,
I need some help. trying to use VB to read the value of a pivot table so I can conditional format the cells. I know how to conditional format using VB on normal cells, but I don't know how for pivot tables. How can I reference values from a pivots table? thank you |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
URGENT! How to read value in pivot table
PLEASE ANY ONE! Does anyone know how to reference the cells of a pivot
table? stoppal wrote: Hi, I need some help. trying to use VB to read the value of a pivot table so I can conditional format the cells. I know how to conditional format using VB on normal cells, but I don't know how for pivot tables. How can I reference values from a pivots table? thank you |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
URGENT! How to read value in pivot table
There must be someone that know's how to do this? I keep getting a
type mismatch, which is why I need to figure out how to reference the pivot table cell not the normal cell. PLEASE HELP!!!!! Private Sub Worksheet_Change(ByVal Target As Range) Dim icolor As Integer If Not Intersect(Target, Range("Q1:Q500")) Is Nothing Then Select Case Target Case "1/1/2001" To "12/31/2001" '2001 icolor = 6 Case 37257 To 37621 '2002 icolor = 12 Case 37622 To 37986 '2003 icolor = 7 Case 37987 To 38352 '2004 icolor = 53 Case 38353 To 38717 '2005 icolor = 15 Case 38718 To 39082 '2006 icolor = 42 Case 39083 To 39447 '2007 icolor = 45 Case 39448 To 39813 '2008 icolor = 47 Case Else 'Whatever End Select Target.Interior.ColorIndex = icolor End If End Sub stoppal wrote: PLEASE ANY ONE! Does anyone know how to reference the cells of a pivot table? stoppal wrote: Hi, I need some help. trying to use VB to read the value of a pivot table so I can conditional format the cells. I know how to conditional format using VB on normal cells, but I don't know how for pivot tables. How can I reference values from a pivots table? thank you |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
URGENT! How to read value in pivot table
Is no one smart enough to know this?
stoppal wrote: There must be someone that know's how to do this? I keep getting a type mismatch, which is why I need to figure out how to reference the pivot table cell not the normal cell. PLEASE HELP!!!!! Private Sub Worksheet_Change(ByVal Target As Range) Dim icolor As Integer If Not Intersect(Target, Range("Q1:Q500")) Is Nothing Then Select Case Target Case "1/1/2001" To "12/31/2001" '2001 icolor = 6 Case 37257 To 37621 '2002 icolor = 12 Case 37622 To 37986 '2003 icolor = 7 Case 37987 To 38352 '2004 icolor = 53 Case 38353 To 38717 '2005 icolor = 15 Case 38718 To 39082 '2006 icolor = 42 Case 39083 To 39447 '2007 icolor = 45 Case 39448 To 39813 '2008 icolor = 47 Case Else 'Whatever End Select Target.Interior.ColorIndex = icolor End If End Sub stoppal wrote: PLEASE ANY ONE! Does anyone know how to reference the cells of a pivot table? stoppal wrote: Hi, I need some help. trying to use VB to read the value of a pivot table so I can conditional format the cells. I know how to conditional format using VB on normal cells, but I don't know how for pivot tables. How can I reference values from a pivots table? thank you |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
URGENT! How to read value in pivot table
I guess no one is smart out there or up to a challenge. This should be
rather simple. I'm surprised no one is has the brain power to answer it. stoppal wrote: Is no one smart enough to know this? stoppal wrote: There must be someone that know's how to do this? I keep getting a type mismatch, which is why I need to figure out how to reference the pivot table cell not the normal cell. PLEASE HELP!!!!! Private Sub Worksheet_Change(ByVal Target As Range) Dim icolor As Integer If Not Intersect(Target, Range("Q1:Q500")) Is Nothing Then Select Case Target Case "1/1/2001" To "12/31/2001" '2001 icolor = 6 Case 37257 To 37621 '2002 icolor = 12 Case 37622 To 37986 '2003 icolor = 7 Case 37987 To 38352 '2004 icolor = 53 Case 38353 To 38717 '2005 icolor = 15 Case 38718 To 39082 '2006 icolor = 42 Case 39083 To 39447 '2007 icolor = 45 Case 39448 To 39813 '2008 icolor = 47 Case Else 'Whatever End Select Target.Interior.ColorIndex = icolor End If End Sub stoppal wrote: PLEASE ANY ONE! Does anyone know how to reference the cells of a pivot table? stoppal wrote: Hi, I need some help. trying to use VB to read the value of a pivot table so I can conditional format the cells. I know how to conditional format using VB on normal cells, but I don't know how for pivot tables. How can I reference values from a pivots table? thank you |
#6
Posted to microsoft.public.excel.programming
|
|||
|
|||
URGENT! How to read value in pivot table
not sure i like the browbeating, and I have no knowledge of pivot
tables, but where are you getting your error? You state that its a type mismatch, where is the mismatch? theSquirrel stoppal wrote: I guess no one is smart out there or up to a challenge. This should be rather simple. I'm surprised no one is has the brain power to answer it. stoppal wrote: Is no one smart enough to know this? stoppal wrote: There must be someone that know's how to do this? I keep getting a type mismatch, which is why I need to figure out how to reference the pivot table cell not the normal cell. PLEASE HELP!!!!! Private Sub Worksheet_Change(ByVal Target As Range) Dim icolor As Integer If Not Intersect(Target, Range("Q1:Q500")) Is Nothing Then Select Case Target Case "1/1/2001" To "12/31/2001" '2001 icolor = 6 Case 37257 To 37621 '2002 icolor = 12 Case 37622 To 37986 '2003 icolor = 7 Case 37987 To 38352 '2004 icolor = 53 Case 38353 To 38717 '2005 icolor = 15 Case 38718 To 39082 '2006 icolor = 42 Case 39083 To 39447 '2007 icolor = 45 Case 39448 To 39813 '2008 icolor = 47 Case Else 'Whatever End Select Target.Interior.ColorIndex = icolor End If End Sub stoppal wrote: PLEASE ANY ONE! Does anyone know how to reference the cells of a pivot table? stoppal wrote: Hi, I need some help. trying to use VB to read the value of a pivot table so I can conditional format the cells. I know how to conditional format using VB on normal cells, but I don't know how for pivot tables. How can I reference values from a pivots table? thank you |
#8
Posted to microsoft.public.excel.programming
|
|||
|
|||
URGENT! How to read value in pivot table
I don't know what the value of the cells you are trying to access have
in them, but maybe you can try and do this. Select Case DateValue(Target.Value) Case #1/1/2001# To #12/31/2001# '2001 theSquirrel On Dec 15, 11:59 am, "stoppal" wrote: the mismatch seems to occur on these lines Select Case Target Case "1/1/2001" To "12/31/2001" '2001 But only when I reference a cell populated by a pivot table. If the cell is normal (meaning no pivot table populated it) then all works. I think there is a way to reference a cell within a pivot table, but I don't know how. thanks for your response. I hope someone can help. I'm at the end of my wits! thanks wrote: not sure i like the browbeating, and I have no knowledge of pivot tables, but where are you getting your error? You state that its a type mismatch, where is the mismatch? theSquirrel stoppal wrote: I guess no one is smart out there or up to a challenge. This should be rather simple. I'm surprised no one is has the brain power to answer it. stoppal wrote: Is no one smart enough to know this? stoppal wrote: There must be someone that know's how to do this? I keep getting a type mismatch, which is why I need to figure out how to reference the pivot table cell not the normal cell. PLEASE HELP!!!!! Private Sub Worksheet_Change(ByVal Target As Range) Dim icolor As Integer If Not Intersect(Target, Range("Q1:Q500")) Is Nothing Then Select Case Target Case "1/1/2001" To "12/31/2001" '2001 icolor = 6 Case 37257 To 37621 '2002 icolor = 12 Case 37622 To 37986 '2003 icolor = 7 Case 37987 To 38352 '2004 icolor = 53 Case 38353 To 38717 '2005 icolor = 15 Case 38718 To 39082 '2006 icolor = 42 Case 39083 To 39447 '2007 icolor = 45 Case 39448 To 39813 '2008 icolor = 47 Case Else 'Whatever End Select Target.Interior.ColorIndex = icolor End If End Sub stoppal wrote: PLEASE ANY ONE! Does anyone know how to reference the cells of a pivot table? stoppal wrote: Hi, I need some help. trying to use VB to read the value of a pivot table so I can conditional format the cells. I know how to conditional format using VB on normal cells, but I don't know how for pivot tables. How can I reference values from a pivots table? thank you- Hide quoted text -- Show quoted text - |
#9
Posted to microsoft.public.excel.programming
|
|||
|
|||
URGENT! How to read value in pivot table
Hi,
A little more detail would be useful - are you trying to have the conditional formatting apply to the whole table? Is it the same condition for all the cells in the table? Here is a simple macro which applies conditional formatting to a specific pivot table. All I did was turn on the recorder. Sub Macro4() ActiveSheet.PivotTables("PivotTable1").PivotSelect "", xlDataOnly, True Selection.FormatConditions.Delete Selection.FormatConditions.Add Type:=xlCellValue, Operator:=xlGreater, _ Formula1:="10" Selection.FormatConditions(1).Interior.ColorIndex = 22 End Sub -- Cheers, Shane Devenshire "stoppal" wrote: Hi, I need some help. trying to use VB to read the value of a pivot table so I can conditional format the cells. I know how to conditional format using VB on normal cells, but I don't know how for pivot tables. How can I reference values from a pivots table? thank you |
#10
Posted to microsoft.public.excel.programming
|
|||
|
|||
URGENT! How to read value in pivot table
thank you for the extra help once again!!!
The reason I need to add condiftional formating using VBO rather than the menu bar is b/c the program has a limit of 3 conditions. I need to have at least 8 different conditions. The code you provided at least provide some reference to the pivot talbe, which is new to me, so thank you. do you know how to reference the value? thanks ShaneDevenshire wrote: Hi, A little more detail would be useful - are you trying to have the conditional formatting apply to the whole table? Is it the same condition for all the cells in the table? Here is a simple macro which applies conditional formatting to a specific pivot table. All I did was turn on the recorder. Sub Macro4() ActiveSheet.PivotTables("PivotTable1").PivotSelect "", xlDataOnly, True Selection.FormatConditions.Delete Selection.FormatConditions.Add Type:=xlCellValue, Operator:=xlGreater, _ Formula1:="10" Selection.FormatConditions(1).Interior.ColorIndex = 22 End Sub -- Cheers, Shane Devenshire "stoppal" wrote: Hi, I need some help. trying to use VB to read the value of a pivot table so I can conditional format the cells. I know how to conditional format using VB on normal cells, but I don't know how for pivot tables. How can I reference values from a pivots table? thank you |
#11
Posted to microsoft.public.excel.programming
|
|||
|
|||
URGENT! How to read value in pivot table
Hi,
I see, its not really conditional formatting its VBA controlled formatting. I'm not sure what you mean by "reference the value", please elaborate. I need more info to help with this. Keep in mind that you will need to run the macro everytime you modify the pivot table. FYI - if and when you get Excel 2007 you will be able to add an unlimited number of conditional formats, instead of just 3. I'm at work this week so I won't always be able to respond quickly. -- Thanks, Shane Devenshire "stoppal" wrote: thank you for the extra help once again!!! The reason I need to add condiftional formating using VBO rather than the menu bar is b/c the program has a limit of 3 conditions. I need to have at least 8 different conditions. The code you provided at least provide some reference to the pivot talbe, which is new to me, so thank you. do you know how to reference the value? thanks ShaneDevenshire wrote: Hi, A little more detail would be useful - are you trying to have the conditional formatting apply to the whole table? Is it the same condition for all the cells in the table? Here is a simple macro which applies conditional formatting to a specific pivot table. All I did was turn on the recorder. Sub Macro4() ActiveSheet.PivotTables("PivotTable1").PivotSelect "", xlDataOnly, True Selection.FormatConditions.Delete Selection.FormatConditions.Add Type:=xlCellValue, Operator:=xlGreater, _ Formula1:="10" Selection.FormatConditions(1).Interior.ColorIndex = 22 End Sub -- Cheers, Shane Devenshire "stoppal" wrote: Hi, I need some help. trying to use VB to read the value of a pivot table so I can conditional format the cells. I know how to conditional format using VB on normal cells, but I don't know how for pivot tables. How can I reference values from a pivots table? thank you |
#12
Posted to microsoft.public.excel.programming
|
|||
|
|||
URGENT! How to read value in pivot table
Unforunately, I can't upgrade to 2007 do to a conflict issue with
another program we need to use. When I say reference the value, I mean cell b5 has the value of a date "12/31/2005", the pivot table has has a range of from a1 to c10 Therefore the values in cell b5 is populated with a value generated from the pivot table. For some reason, I can not reference the cell directly and pull the value. PLease see code above. Any ideas as to how to read the value of the date in cell b5? thanks ShaneDevenshire wrote: Hi, I see, its not really conditional formatting its VBA controlled formatting. I'm not sure what you mean by "reference the value", please elaborate. I need more info to help with this. Keep in mind that you will need to run the macro everytime you modify the pivot table. FYI - if and when you get Excel 2007 you will be able to add an unlimited number of conditional formats, instead of just 3. I'm at work this week so I won't always be able to respond quickly. -- Thanks, Shane Devenshire "stoppal" wrote: thank you for the extra help once again!!! The reason I need to add condiftional formating using VBO rather than the menu bar is b/c the program has a limit of 3 conditions. I need to have at least 8 different conditions. The code you provided at least provide some reference to the pivot talbe, which is new to me, so thank you. do you know how to reference the value? thanks ShaneDevenshire wrote: Hi, A little more detail would be useful - are you trying to have the conditional formatting apply to the whole table? Is it the same condition for all the cells in the table? Here is a simple macro which applies conditional formatting to a specific pivot table. All I did was turn on the recorder. Sub Macro4() ActiveSheet.PivotTables("PivotTable1").PivotSelect "", xlDataOnly, True Selection.FormatConditions.Delete Selection.FormatConditions.Add Type:=xlCellValue, Operator:=xlGreater, _ Formula1:="10" Selection.FormatConditions(1).Interior.ColorIndex = 22 End Sub -- Cheers, Shane Devenshire "stoppal" wrote: Hi, I need some help. trying to use VB to read the value of a pivot table so I can conditional format the cells. I know how to conditional format using VB on normal cells, but I don't know how for pivot tables. How can I reference values from a pivots table? thank you |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Multiple Range Pivot Table (Urgent Please) | Excel Discussion (Misc queries) | |||
URGENT PLEASE! Filtering a Pivot Table further | Excel Worksheet Functions | |||
Pivot Table Nightmare Urgent help required | Excel Programming | |||
pivot table error.Please help! very urgent | Excel Discussion (Misc queries) | |||
urgent-pivot table | Excel Programming |