Results 1 to 6 of 6

Macro won't work twice

Threaded View

  1. #1
    Forum Contributor
    Join Date
    11-18-2009
    Location
    Winnipeg
    MS-Off Ver
    Excel 2003
    Posts
    203

    Macro won't work twice

    I have the following macro that I use to convert numbers stored as text to text. For some reason, if I try to use it twice in a row, it won't work, I get an error that says "application-defined or object-defined error" and highlights this part of the code:

    Cells.SpecialCells(xlCellTypeLastCell) _
    .Offset(1, 1).Copy
    Sub ConvertToNumbers()
      Cells.SpecialCells(xlCellTypeLastCell) _
        .Offset(1, 1).Copy
      Selection.PasteSpecial Paste:=xlPasteValues, _
         Operation:=xlPasteSpecialOperationAdd
      With Selection
         .VerticalAlignment = xlTop
         .WrapText = False
      End With
      Selection.EntireColumn.AutoFit
    End Sub
    Last edited by kmlloyd; 12-03-2009 at 03:11 PM.

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