+ Reply to Thread
Results 1 to 6 of 6

This code takes way to long to run

  1. #1
    Registered User
    Join Date
    11-07-2011
    Location
    Pittsburgh, PA
    MS-Off Ver
    Excel 2007
    Posts
    22

    This code takes way to long to run

    Could someone show me a better way?


    Sub ProperlySave()
    '
    ' ProperlySave Macro
    ' Converts upper case to proper then saves file
    '

    '


    For Each x In Range("C1:C300", "F1:F300")
    ' There is not a Proper function in Visual Basic for Applications.
    ' So, you must use the worksheet function in the following form:
    x.Value = Application.Proper(x.Value)
    Next



    ActiveWorkbook.Save
    End Sub


    Thanks,
    Jim

  2. #2
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,482

    Re: This code takes way to long to run

    Please Login or Register  to view this content.

  3. #3
    Forum Expert leelnich's Avatar
    Join Date
    03-20-2017
    Location
    Delaware, USA
    MS-Off Ver
    Office 2016
    Posts
    2,807

    Re: This code takes way to long to run

    Quote Originally Posted by davesexcel View Post
    Please Login or Register  to view this content.
    ...which is equivalent to:
    Please Login or Register  to view this content.
    for those who prefer not to use [shortcut] notation.
    Last edited by leelnich; 10-31-2017 at 09:37 AM. Reason: Corrected typo "C3:C100"
    Clicking the Add Reputation star below helpful posts is a great way to show your appreciation.
    Please mark your threads as SOLVED upon conclusion (Thread Tools above Post # 1). - Lee

  4. #4
    Registered User
    Join Date
    11-07-2011
    Location
    Pittsburgh, PA
    MS-Off Ver
    Excel 2007
    Posts
    22

    Re: This code takes way to long to run

    Thinks davesexcel,

    Where do I insert or replace that? And how do I do the F column range.

  5. #5
    Registered User
    Join Date
    11-07-2011
    Location
    Pittsburgh, PA
    MS-Off Ver
    Excel 2007
    Posts
    22

    Re: This code takes way to long to run

    Thank you davesexcel and leelnich! They both work great! Thank you!

  6. #6
    Forum Expert leelnich's Avatar
    Join Date
    03-20-2017
    Location
    Delaware, USA
    MS-Off Ver
    Office 2016
    Posts
    2,807

    Re: This code takes way to long to run

    Sorry, thought it was just 1 column. The INDEX worksheet function can also return a 2-dimensional range or array. Try this:
    Please Login or Register  to view this content.
    INDEX(Array,Row_Number,Column_Number)
    If Row_number = 0 or empty, the entire row range is returned (meaning the array's entire COLUMN(s)). Similarly, a 0 or empty Column_number returns the entire column range. So setting BOTH to 0 (or empty) returns the ENTIRE Array or range.
    Last edited by leelnich; 10-31-2017 at 11:25 AM.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] code ignore different spelling and takes a long time
    By torti111 in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 08-04-2017, 05:14 AM
  2. [SOLVED] Translate code takes long time
    By YasserKhalil in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 08-28-2016, 12:58 AM
  3. The runtime for my code I wrote takes too long, is there a way tocan you condense?
    By dnice0123 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-18-2014, 03:33 AM
  4. Inefficient code - macro takes too long
    By dantray02 in forum Excel Programming / VBA / Macros
    Replies: 14
    Last Post: 03-07-2014, 09:29 AM
  5. Clunky Slow Code, Hides Empty Rows, Takes too long...
    By BoSonic in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 12-18-2013, 08:56 PM
  6. Long code takes an age to run
    By E3iron in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 10-05-2009, 07:38 AM
  7. My Code takes too long to execute
    By coreytroy in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 07-30-2008, 12:12 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