Results 1 to 6 of 6

compile error with selection.pastespecial code

Threaded View

  1. #1
    Forum Contributor
    Join Date
    08-04-2004
    Location
    Amsterdam
    MS-Off Ver
    2016
    Posts
    186

    compile error with selection.pastespecial code

    I had used this before but now i get an "expected function or variable error" with this line of code. I get error as soon as I run macro but i cannot see what is at fault

    selection.PasteSpecial Paste:=xlPasteAll, Operation:=xlDivide, SkipBlanks _
            :=False, Transpose:=False
    Whole macro here
    Sub knmitxtfile()
    Dim fNameAndPath As Variant
    fNameAndPath = Application.GetOpenFilename(FileFilter:=Filt, FilterIndex:=FilterIndex, Title:="Select File To Be Opened")
    If fNameAndPath = False Then Exit Sub
    Workbooks.OpenText Filename:=fNameAndPath, Origin:= _
            437, startrow:=1, DataType:=xlDelimited, TextQualifier:=xlDoubleQuote, _
            ConsecutiveDelimiter:=False, Tab:=False, Semicolon:=False, Comma:=True _
            , Space:=False, Other:=False, FieldInfo:=Array(1, 1), _
            TrailingMinusNumbers:=True
    Range("V9").Select
        ActiveCell.FormulaR1C1 = "10"
        Range("v9").Copy
            Sheet1.Range("K25", Range("S65536").End(xlUp)).Select
         selection.PasteSpecial Paste:=xlPasteAll, Operation:=xlDivide, SkipBlanks _
            :=False, Transpose:=False
            Application.CutCopyMode = False
        Range("M25:O25").Select
        Range(selection, selection.End(xlDown)).Select
        selection.PasteSpecial Paste:=xlPasteAll, Operation:=xlDivide, SkipBlanks _
            :=False, Transpose:=False
        Range("P24").Select
        Application.CutCopyMode = False
    End Sub
    Last edited by philaugust2004; 03-05-2017 at 02:06 PM. Reason: add tags

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Compile Error upon selection
    By bralew in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 09-01-2016, 10:48 AM
  2. [SOLVED] code compile error
    By Burt_100 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-09-2015, 03:43 AM
  3. [SOLVED] Compile Error VBA error code attached
    By cgibson92 in forum Excel Programming / VBA / Macros
    Replies: 14
    Last Post: 06-01-2015, 11:07 AM
  4. code generating compile error: syntex error
    By sankarsasmal in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 12-10-2013, 05:29 AM
  5. [SOLVED] Compile Error in Hidden Module and Compile Error: Can't find project or library
    By Taislin in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 08-10-2013, 07:03 PM
  6. [SOLVED] Intermittent Error 1004 on Selection.PasteSpecial
    By BeachRock in forum Excel Programming / VBA / Macros
    Replies: 20
    Last Post: 10-21-2012, 01:23 AM
  7. VB code - compile error box help!!!
    By excel.xls in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 05-10-2007, 10:15 AM

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