Hi there,
I am trying to record simple macro in excel 2007 as below
Sub Macro1()
‘
‘ Macro1 Macro
‘
‘
Range(“A1”).Select
Selection.CurrentRegion.Select
Selection.Copy
Sheets.Add
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
Selection.AutoFilter
ActiveSheet.Range(“$A$1:$AG$967”).AutoFilter Field:=4, Criteria1:= _
“511000-Advance-”
Selection.Copy
Sheets.Add
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
ActiveWorkbook.Worksheets(“Sheet3”).Sort.SortFields.Clear
ActiveWorkbook.Worksheets(“Sheet3”).Sort.SortFields.Add Key:=Range(“C2:C3”), _
SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal
With ActiveWorkbook.Worksheets(“Sheet3”).Sort
.SetRange Range(“A1:AG3”)
.Header = xlYes
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
Selection.Style = “Comma”
Selection.NumberFormat = “_(* #,##0.0_);_(* (#,##0.0);_(* “”-“”??_);_(@_)”
Selection.NumberFormat = “_(* #,##0_);_(* (#,##0);_(* “”-“”??_);_(@_)”
Columns(“A:A”).Select
Selection.NumberFormat = “[$-409]d/mmm/yy;@”
Range(“H2”).Select
ActiveWindow.FreezePanes = True
Columns(“M:AH”).Select
Selection.Delete Shift:=xlToLeft
Sheets(“Sheet3”).Select
Sheets(“Sheet3”).Name = “Advance Register”
Range(“D21”).Select
End Sub
but always appears errors (debug message)
I don’t know what was wrong, which did not happen using 2003
thanks in advance
Indra