+ Reply to Thread
Results 1 to 2 of 2

Optimizing Code

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    02-16-2008
    Location
    Mansfield, TX
    Posts
    324

    Optimizing Code

    Hello, the code below is an amalgamation of recorded macros. As I have only limited skills in VBA, can one of the gurus here help me optimize this for efficiency and speed?

    Range("A2").Select
          Range("A2", Selection.End(xlDown)).Select
        
        With Selection
            Selection.NumberFormat = "General"
            .Value = .Value
        End With
        
        Range("G2").Select
          Range("G2", Selection.End(xlDown)).Select
        
        With Selection
            Selection.NumberFormat = "General"
            .Value = .Value
        End With
        
        Range("h2").Select
          Range("h2", Selection.End(xlDown)).Select
        
        With Selection
            Selection.NumberFormat = "General"
            .Value = .Value
        End With
        
        Range("l2", ActiveCell.SpecialCells(xlLastCell)).Select
        Application.Run "PERSONAL.XLSB!converttexttonumbers"

  2. #2
    Forum Expert mike7952's Avatar
    Join Date
    12-17-2011
    Location
    Florida
    MS-Off Ver
    Excel 2007, Excel 2016
    Posts
    3,551

    Re: Optimizing Code

    Maybe this

        With Columns("A:A")
            .NumberFormat = "General"
            .Value = .Value
        End With
            
        With Columns("G:H")
            .NumberFormat = "General"
            .Value = .Value
        End With
        
        Range("l2", Cells(Rows.Count, "l").End(xlUp)).Select
        Application.Run "PERSONAL.XLSB!converttexttonumbers"
    Last edited by mike7952; 10-23-2012 at 11:23 AM.
    Thanks,
    Mike

    If you are satisfied with the solution(s) provided, please mark your thread as Solved.
    Select Thread Tools-> Mark thread as Solved.

+ Reply to Thread

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