jordiejones
New Member
- Joined
- May 5, 2010
- Messages
- 31
Hello All, I am an absolute n00b when it comes to VB. most of my code was written in MacroRecorder and edited to clean it up and make it more readable to a computer. This code works fine in 2007 but my store computers use 2003. Can someone please help me identify what I can change to make this work in 2003?
Line that I'm getting an error on:
Run-time error '438': Object doesn't support this property or method
Thanks for your time - Jordan!
Line that I'm getting an error on:
Run-time error '438': Object doesn't support this property or method
Code:
ActiveWorkbook.Worksheets("Sales Recap ").Sort.SortFields.Clear
Code:
Sub Macro1()
'
' Macro1 Macro
'
' Keyboard Shortcut: Ctrl+j
'
'!!!FILES WORK BEST WHEN STORED IN THE SAME ROOT ei. C:\My Documents\Manager's Folders\Store Manager\
'BEGIN OPEN CHILD WORKBOOKS
Cells.Select
Selection.Copy
'!!!PLACE THE FULL ROOT OF YOUR FLASH METRICS FILE HERE
Workbooks.Open Filename:="C:\Documents and Settings\Administrator\My Documents\Manager's Folders\JORDAN\VB Macros\Flash Metrics.xls"
'!!!PLACE THE FULL ROOT OF YOUR TEMP BOOK FILE HERE
Workbooks.Open Filename:="C:\Documents and Settings\Administrator\My Documents\Manager's Folders\JORDAN\VB Macros\TempBook.xls"
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
'END OPEN CHILD WORKBOOKS
'BEGIN CLEAR OLD DATA
Windows("Flash Metrics.xls").Activate
Range("A5:Q35").Select
Selection.ClearContents
With Selection.Interior
.Pattern = xlNone
End With
Range("A40:Q70").Select
Selection.ClearContents
With Selection.Interior
.Pattern = xlNone
End With
Range("A74:Q104").Select
Selection.ClearContents
With Selection.Interior
.Pattern = xlNone
End With
'END CLEAR OLD DATA
'BEGIN DAY METRIC SORT
'BEGIN NETSALES SORT
Windows("TempBook.xls").Activate
Range("A4:B34").Select
Range("B34").Activate
Selection.Copy
Windows("Flash Metrics.xls").Activate
Range("A5").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Range("A14:B14").Select
Application.CutCopyMode = False
With Selection.Interior
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
.Color = 65535
End With
Range("A5:B35").Select
ActiveWorkbook.Worksheets("Sales Recap ").Sort.SortFields.Clear
ActiveWorkbook.Worksheets("Sales Recap ").Sort.SortFields.Add Key:=Range( _
"B5:B35"), SortOn:=xlSortOnValues, Order:=xlDescending, DataOption:= _
xlSortNormal
With ActiveWorkbook.Worksheets("Sales Recap ").Sort
.SetRange Range("A5:B35")
.Header = xlGuess
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
'END NETSALES SORT
' more code....
End Sub
Thanks for your time - Jordan!