Results 1 to 11 of 11

Cut and Paste Code Error

Threaded View

  1. #1
    Forum Contributor
    Join Date
    09-19-2004
    Location
    Canada
    Posts
    408

    Cut and Paste Code Error

    Hi all,

    I am working on the following code:

    Option Explicit
    Sub Report_Formatting()
    Dim Fname As String, Sname As String, LastRow As Long
    Fname = InputBox("Please copy and paste the name of the report, here", "REPORT NAME")
    If Fname = "" Then Exit Sub
    Workbooks.OpenText FileName:="http://sharepoint/Testing/REPORTS/" & Fname & ".csv", DataType:=xlDelimited, _
    TextQualifier:=xlTextQualifierNone, FieldInfo:=Array(1, 4), Local:=True
    If Len(Fname) < 31 Or Len(Fname) = 31 Then
    Sname = Left(Fname, Len(Fname) - 8)
    Else
    Sname = Left(Fname, 31)
    End If
    ActiveWorkbook.Worksheets.Add(After:=Sheets(Sheets.Count)).Name = "Summary"
    Worksheets(Sname).Activate
    LastRow = Range("A" & Rows.Count).End(xlUp).Row
    Range("A" & LastRow - 13 & ":A" & LastRow).EntireRow.Cut Sheets("Summary").Range("A1")
    With Selection.Font
        .Name = "Lucide Console"
        .Size = 7
        .Strikethrough = False
        .Superscript = False
        .Subscript = False
        .OutlineFont = False
        .Shadow = False
        .Underline = xlUnderlineStyleNone
        .ColorIndex = xlAutomatic
    End With
    ActiveSheet.Columns("A:A").ColumnWidth = 22.71
    Rows("1:14").RowHeight = 12
    End Sub
    It is failing at the line:

    Range("A" & LastRow - 13 & ":A" & LastRow).EntireRow.Cut Sheets("Summary").Range("A1")
    Can someone please help me fix it.

    Thank you,
    Gos-C
    Last edited by Gos-C; 11-21-2010 at 02:25 PM.
    Using Excel 2010 & Windows 10
    "It is better to be prepared for an opportunity and not have one than to have an opportunity and not be prepared."

Thread Information

Users Browsing this Thread

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

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