Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
BEE BEE is offline
external usenet poster
 
Posts: 10
Default Pivot Output formatting.

I have pivot table output from stored procedure via
VBScript. I'd like the greatest value per row to be
highlighted in red.

Network CHAN Devi
CHAN 19343 8864
Devi 8864 31942

And where CHAN = CHAN I'd like the cell bold, Devi = Devi
same, and on down the rest of the pivot output.

Any input would be welcomed.
B
  #2   Report Post  
Posted to microsoft.public.excel.programming
BEE BEE is offline
external usenet poster
 
Posts: 10
Default Pivot Output formatting (code)

Public Sub NetworkCrossCheck()
Dim rsReport As New ADODB.Recordset
Dim cnReport As New ADODB.Connection
Dim cmdReport As New ADODB.Command
Dim lrow As Long
Dim lCol As Long
Dim pc As PivotCache
Dim pt As PivotTable
Dim wb As Workbook

On Error GoTo NetworkCrossCheckError

cnReport.ConnectionString = "DSN=CM_Mod3SQL_DEV;"
cnReport.CursorLocation = adUseClient
cnReport.Open

If (cnReport.State < adStateOpen) Then
MsgBox "Database connection not open, cannot run
query"
Exit Sub
End If

Set cmdReport.ActiveConnection = cnReport
cmdReport.CommandText = "rpt_NetworkCrossCheck_sp"
cmdReport.CommandType = adCmdStoredProc
cmdReport.CommandTimeout = 300

Set rsReport = cmdReport.Execute

Set wb = Workbooks.Open(sPath
& "NetworkCrossCheck_template.xls", 0, True)
Set pc = ActiveWorkbook.PivotCaches.Add
(SourceType:=xlExternal)
Set pc.Recordset = rsReport
pc.CreatePivotTable TableDestination:=Range("A3"),
TableName:="Network Cross Check"


With ActiveSheet.PivotTables("Network Cross Check")
.SmallGrid = False
.RowGrand = False
.ColumnGrand = False
With .PivotFields("NetworkName")
.Orientation = xlRowField
.Position = 1
End With
With .PivotFields("NetworkName1")
.Orientation = xlColumnField
.Position = 1
End With
With .PivotFields("TaxID")
.Orientation = xlDataField
.Position = 1

End With
End With

Set rsReport = Nothing
Set cmdReport = Nothing
Set cnReport = Nothing
Set wb = Nothing
'cnReport.Close

Exit Sub

NetworkCrossCheckError:
MsgBox CStr(Err.Number) & ": " & Err.Description &
vbCrLf & "Please call support",
vbExclamation, "NetworkCrossCheck"
Resume Next

End Sub
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 473
Default Pivot Output formatting.

Bee wrote:
I'd like the greatest value per row to be
highlighted in red.


Sounds like a job for conditional formatting

Select the data area of the pivot table
Say the top left cell is B4
Format / Conditional Formatting / Formula Is / =B4=MAX(4:4) / Format /
Font / Red / OK...
Add / Formula Is / =B$3=$A4 / Format / Font / Bold / OK / OK

If you recorded a macro while doing that you could incorporate it in
your code.

Bill Manville
MVP - Microsoft Excel, Oxford, England
No email replies please - reply in newsgroup

  #4   Report Post  
Posted to microsoft.public.excel.programming
BEE BEE is offline
external usenet poster
 
Posts: 10
Default Pivot Output formatting.

Cool Bill. Thanks. I will give this a try.
Regards,
B.
Reply
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
Formatting Output Range in Combo Box V2 Excel Discussion (Misc queries) 2 February 23rd 09 01:10 PM
Formatting text output within formulas Colin Hayes Excel Worksheet Functions 1 January 16th 09 02:04 PM
conditional formatting w/ color as input vs output tom Excel Worksheet Functions 3 December 13th 06 02:34 AM
Can I pull field as datafield or as a output from a pivot table re Vikram Dhemare Excel Discussion (Misc queries) 8 April 12th 06 04:57 AM
Formatting equation output David Thurston Excel Programming 1 December 12th 03 08:04 PM


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

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

About Us

"It's about Microsoft Excel"