+ Reply to Thread
Results 1 to 9 of 9

Code won't work in Excel 2003 in Citrix but does on desktop (Excel 2010)

Hybrid View

  1. #1
    Registered User
    Join Date
    01-16-2014
    Location
    Derby, England
    MS-Off Ver
    365
    Posts
    60

    Code won't work in Excel 2003 in Citrix but does on desktop (Excel 2010)

    Hi all,
    I have a code that another member kindly put together for me. It works on my desktop (Excel 2010) but when I log on via Citrix and open Excel 2003. When I refresh the pivot table the dates change to US format so instead of 07/12/2016, 08/12/2016 & 09/12/2016 it changes to 12/07/2016, 12/08/2016 & 12/09/2016.

    Sub AllWorksheetPivots()
        Const SUMMARY_PIVOT_DATASHEET As String = "Summary_pivot_data"
        Const PIVOT_SHEETS As String = "Camerons|Tadcaster|Hereford|Royal|Caledonian|Zoutewoude"
        
        Dim ws As Worksheet
        Dim cell As Range
        Dim pvt As PivotTable
        Dim pcell As PivotCell
        Dim pi As PivotItem
        Dim sheetList() As String
        Dim sheetName
        Dim x As Long, y As Long, rowNum As Long
        
        sheetList = Split(PIVOT_SHEETS, "|")
        
        ' either get or create sheet for summary data for the pivot table
        On Error Resume Next
        Set ws = ThisWorkbook.Sheets(SUMMARY_PIVOT_DATASHEET)
        On Error GoTo 0
        If ws Is Nothing Then
            Set ws = ThisWorkbook.Sheets.Add(after:=ThisWorkbook.Sheets("Summary"))
            ws.Name = SUMMARY_PIVOT_DATASHEET
        End If
        
        ws.UsedRange.Clear
        ws.Range("A1:F1").Value2 = Array("Plan", "Location", "Week", "Date", "Vol", "Count")
        rowNum = 2
        For Each sheetName In sheetList
            For Each pvt In ThisWorkbook.Sheets(sheetName).PivotTables
                ' check for rows of actual data - every pivot has grand totals so will always have 1 row
                If pvt.DataBodyRange.Rows.Count > 1 Then
                    For Each cell In pvt.DataBodyRange.Columns(1).Cells
                        Set pcell = cell.PivotCell
                        If pcell.RowItems.Count > 1 Then
                            For x = 1 To pcell.RowItems.Count
                                ws.Cells(rowNum, x + 2) = pcell.RowItems(x).Value
                            Next x
                            ws.Cells(rowNum, 1).Value2 = sheetName
                            ws.Cells(rowNum, 2).Value2 = pcell.ColumnItems(1).Value
                            ws.Cells(rowNum, 6).Value2 = cell.Value2
                            rowNum = rowNum + 1
                        End If
                    Next cell
                End If
            Next pvt
        Next sheetName
        
        ws.Range("A1").CurrentRegion.Name = SUMMARY_PIVOT_DATASHEET
        Sheets("Summary").PivotTables("Summary_pivot").RefreshTable
    
    End Sub

    Is there was way to work around this?
    Thanks in advance

  2. #2
    Forum Contributor frabulator's Avatar
    Join Date
    09-16-2015
    Location
    United States
    MS-Off Ver
    2019
    Posts
    105

    Re: Code won't work in Excel 2003 in Citrix but does on desktop (Excel 2010)

    Does formatting the column to show English UK Dates instead of English US Dates work?

    *---EDIT---*

    if it does then you can add this to the bottom of your sub

    Range("$K:$K").NumberFormat = "m/d/yyyy"
    just replace the "K"'s with what ever column you need. If you would like it in the other format (ie: DAY/MONTH/YEAR) then use this format "d/m/yyyy"
    Last edited by frabulator; 12-21-2016 at 10:28 AM.

  3. #3
    Registered User
    Join Date
    01-16-2014
    Location
    Derby, England
    MS-Off Ver
    365
    Posts
    60

    Re: Code won't work in Excel 2003 in Citrix but does on desktop (Excel 2010)

    I am afraid not, tried to format all cells that were affected but to no avail.

    It's frustrating, it works beautifully on the desktop it's just through Citrix it doesn't!
    The dates on the individual pivots tables are correct, it's just the summary data that is incorrect.

  4. #4
    Forum Expert CK76's Avatar
    Join Date
    06-16-2015
    Location
    ONT, Canada
    MS-Off Ver
    MS365 Apps for enterprise
    Posts
    5,973

    Re: Code won't work in Excel 2003 in Citrix but does on desktop (Excel 2010)

    I suspect Citrix's session regional setting is what's causing this issue.

    See link for how to set up Citrix.
    https://support.citrix.com/article/CTX103288

  5. #5
    Registered User
    Join Date
    01-16-2014
    Location
    Derby, England
    MS-Off Ver
    365
    Posts
    60

    Re: Code won't work in Excel 2003 in Citrix but does on desktop (Excel 2010)

    Hi,
    Tried changing the settings but they were all set to UK already. 'Changed' them and applied, logged off but still not working.

  6. #6
    Forum Expert CK76's Avatar
    Join Date
    06-16-2015
    Location
    ONT, Canada
    MS-Off Ver
    MS365 Apps for enterprise
    Posts
    5,973

    Re: Code won't work in Excel 2003 in Citrix but does on desktop (Excel 2010)

    Also check Excel's language setting/format when accessing through Citrix, make sure it matching Windows.

  7. #7
    Registered User
    Join Date
    01-16-2014
    Location
    Derby, England
    MS-Off Ver
    365
    Posts
    60

    Re: Code won't work in Excel 2003 in Citrix but does on desktop (Excel 2010)

    Is there a way to do that other than from the Start Menu? There's no language settings option on the Microsoft Office Tools.

  8. #8
    Forum Expert CK76's Avatar
    Join Date
    06-16-2015
    Location
    ONT, Canada
    MS-Off Ver
    MS365 Apps for enterprise
    Posts
    5,973

    Re: Code won't work in Excel 2003 in Citrix but does on desktop (Excel 2010)

    Hmm, you may be missing some components. Sorry, can't help you further as I don't have copy of Office/Excel 2003.

  9. #9
    Registered User
    Join Date
    01-16-2014
    Location
    Derby, England
    MS-Off Ver
    365
    Posts
    60

    Re: Code won't work in Excel 2003 in Citrix but does on desktop (Excel 2010)

    Thanks anyway. back to the drawing board for me, might be worth a call to my IT dept!
    After the initial, turn it off and back on again instruction they may be helpful!

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Excel 2003/Outlook Code Does not Work in Outlook 2010
    By blackscholes in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-26-2014, 12:58 PM
  2. Replies: 0
    Last Post: 12-18-2013, 07:59 PM
  3. [SOLVED] Excel 2003 Macro Won't work in Excel 2010
    By timbo1957 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 11-12-2013, 06:42 AM
  4. My Excel 2003 vba code does not work in excel 2010. Somebody help!
    By DeNam in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 02-01-2013, 10:05 AM
  5. [SOLVED] Why does this VB work in Excel 2003 but not in Excel 2010
    By quickheart in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-20-2012, 12:38 PM
  6. Excel 2003 macro won't work in Excel 2010
    By texan22 in forum Excel Programming / VBA / Macros
    Replies: 23
    Last Post: 08-09-2012, 10:51 AM
  7. Code won't work in Excel 2003, but will in 2007/2010
    By Mak2145 in forum Excel Programming / VBA / Macros
    Replies: 21
    Last Post: 03-30-2012, 12:23 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1