Hello,
I'm Receivng an error when I open a workbook:
Any ideas as to what may be causing it? The workook is an xlsx workbook, so no macros/VBA. Although, a macro is used to create the workbook and there is a sort associated with that macro but that code is in a different workbook.
Thank you,
Roger
code that populates workbook in case relavent...
I'm Receivng an error when I open a workbook:
Removed Records: Sorting from /xl/worksheets/sheet6.xml part
Any ideas as to what may be causing it? The workook is an xlsx workbook, so no macros/VBA. Although, a macro is used to create the workbook and there is a sort associated with that macro but that code is in a different workbook.
Thank you,
Roger
code that populates workbook in case relavent...
Code:
'remove data from dashboard for worksheet in current row
wb1.Sheets(strWksName).Range("D2:BB500000").ClearContents
wb1.Sheets(strWksName).Range("A3:C500000").ClearContents
'open the workbook from which the data will be retreived
Call OpenWb(strFilePath, strFileName)
Set wb2 = Workbooks(strFileName)
Set ws2 = wb2.Sheets(ws.Range("C" & c.Row).Value)
Set ws1 = wb1.Sheets(ws.Range("H" & c.Row).Value)
'find the last row of data to be retrieved
FinalRow = ws2.Range("A" & Rows.Count).End(xlUp).Row
'find the last column of data to be retrieved
If strEndCol = "LAST" Or strEndCol = "last" Then
'find column number and convert to letter
FinalCol = ws2.Cells(1, ws2.Columns.Count).End(xlToLeft).Column
strEndCol = Split(Cells(1, FinalCol).Address, "$")(1)
End If
'copy rows from source file into corresponding worksheet in dashboard
ws2.Range("A2:" & strEndCol & FinalRow).Copy
'paste data from source file into dashboard
wb1.Sheets(strWksName).Range("D2").PasteSpecial xlPasteAll
'sort
wb1.Activate
wb1.Sheets(strWksName).Range("D1:AD500000").Select
ws1.Sort.SortFields.Add Key:=Range( _
"D2:D" & FinalRow), SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:= _
xlSortNormal
ws1.Sort.SortFields.Add Key:=Range( _
"G2:G" & FinalRow), SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:= _
xlSortNormal
ws1.Sort.SortFields.Add Key:=Range( _
"O2:O" & FinalRow), SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:= _
xlSortNormal
With ws1.Sort
.SetRange Range("D1:AD" & FinalRow)
.Header = xlYes
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
'copy formulas from a2:c2 down to the final row
ws1.Range("A2:C2").Copy
ws1.Range("A3:C" & FinalRow).PasteSpecial xlPasteFormulasAndNumberFormats
ws1.Range("A1").Select
'close source workbook
wb2.Close