Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Excel 201VB Issue ActiveSheet.Paste gets Compile Error "Expected Function or variable" - d

Status
Not open for further replies.

NWildblood

Technical User
Nov 12, 2007
113
GB
Hi - any help gratefully received !

I have a very straightforward ms excel formatting macro which for reasons beyond my simple mind gets a Compile Error "Expected Function or variable".
I have run similar macro without a hitch for a long time.
Have just 2 days ago upgraded to 2010.

(The s/sheet is password protected, however have pasted into new workbook and am experiencing the same problem.)

Thanks in advance !

The code is here.

Sub FFUploadKGH()
'
' FFUploadKGH Macro
'

'
Range("A3:D7706").Select
Range(Selection, Selection.End(xlDown)).Select
Selection.ClearContents
Columns("E:E").Select
Selection.Replace What:=" ", Replacement:="", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False
Selection.NumberFormat = "@"
Selection.Copy
Application.CutCopyMode = False
Columns("E:E").Select
Selection.Copy
Columns("F:F").Select
Selection.Insert Shift:=xlToRight
Application.CutCopyMode = False
Range("F3").Select
Selection.AutoFilter
Range("F1").Select
Selection.Delete Shift:=xlToLeft
Range("E2:E8908").Select
Selection.ClearContents
Range("G4:G581").Select
Range(Selection, Selection.End(xlDown)).Select
Range("G4:G9921").Select
Selection.Cut
Range("C4").Select
ActiveSheet.Paste
Columns("C:C").Select
Selection.TextToColumns Destination:=Range("C1"), DataType:=xlFixedWidth, _
FieldInfo:=Array(Array(0, 1), Array(10, 1)), TrailingMinusNumbers:=True
Columns("C:C").Select
Selection.NumberFormat = "dd/mm/yyyy;@"
Range("D4:D4414").Select
Range(Selection, Selection.End(xlDown)).Select
Range("D4:D7054").Select
Selection.ClearContents
Range("J4").Select
Range(Selection, Selection.End(xlDown)).Select
Range("J4:J7626").Select
Selection.Cut
Range("D4").Select
ActiveSheet.Paste
Range("H4").Select
Range(Selection, Selection.End(xlDown)).Select
Range("H4:H9291").Select
Selection.Cut
Range("G4").Select
ActiveSheet.Paste
Range("I4:M206").Select
Range(Selection, Selection.End(xlDown)).Select
Range("I4:M9336").Select
Selection.ClearContents
Range("B4").Select
ActiveCell.FormulaR1C1 = "=NOW()"
Range("B4").Select
Selection.AutoFill Destination:=Range("B4:B5755")
Range("B4:B5755").Select
Columns("B:B").Select
Selection.NumberFormat = "m/d/yyyy"
Columns("B:B").Select
Selection.Copy
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
Range("B4").Select
Range(Selection, Selection.End(xlDown)).Select
ActiveWindow.SmallScroll Down:=10
Range("B3").Select

MsgBox "Now clear duplicates"
End Sub



"No-one got everything done by Friday except Robinson Crusoe...
 
hi,

You will get better response in forum707.

Skip,

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 
Thanks Skip, will do.

"No-one got everything done by Friday except Robinson Crusoe...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top