+ Reply to Thread
Results 1 to 5 of 5

Help in modifying code to find the last used row in a column.

  1. #1
    Forum Contributor
    Join Date
    05-04-2013
    Location
    Australia
    MS-Off Ver
    Excel 2010
    Posts
    125

    Help in modifying code to find the last used row in a column.

    Hi all,

    I have the following code with a Get folder function to open and process CSV file contained within a folder.

    The code changes the format of the date in column D and saves as text in YYYY-MM-DD format. The range of cells has until now been static in D2:D228, but unfortunately it now need to vary.

    So I'm trying to modify the code to apply the formula in column F but only until it reaches the last row of data in column A.

    I've added the following code into into the procedure but unfortunately it hangs

    Please Login or Register  to view this content.

    Here's the amended code:

    Please Login or Register  to view this content.

    Any ideas what's gone wrong?

    Thanks

    David


    Original code below

    Please Login or Register  to view this content.

  2. #2
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    WinXP/MSO2007;Win10/MSO2016
    Posts
    12,068

    Re: Help in modifying code to find the last used row in a column.

    With .Range("F2:F" & LastRow).Select =====> Delete .Select
    Ben Van Johnson

  3. #3
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    38,873

    Re: Help in modifying code to find the last used row in a column.

    You've added a ".Select" to the With Range("D2:D" & LastRow)

    Lose it


    Regards, TMS
    Trevor Shuttleworth - Excel Aid

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  4. #4
    Forum Contributor
    Join Date
    05-04-2013
    Location
    Australia
    MS-Off Ver
    Excel 2010
    Posts
    125

    Re: Help in modifying code to find the last used row in a column.

    I just realised that was the reason. Thanks protonleah and tms.

    Much appreciated.

  5. #5
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    38,873

    Re: Help in modifying code to find the last used row in a column.

    You're welcome.



    If you are satisfied with the solution(s) provided, please mark your thread as Solved.


    New quick method:
    Select Thread Tools-> Mark thread as Solved. To undo, select Thread Tools-> Mark thread as Unsolved.

    Or you can use this way:

    How to mark a thread Solved
    Go to the first post
    Click edit
    Click Go Advanced
    Just below the word Title you will see a dropdown with the word No prefix.
    Change to Solved
    Click Save


    You may also want to consider thanking those people who helped you by clicking on the little star at the bottom left of their reply to your question.

+ 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. find and replace macro, modifying code in engagement
    By alan audit in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-28-2014, 04:56 AM
  2. Modifying existing VBA code to find different file name
    By PittsburghEng in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-03-2010, 03:24 PM
  3. Help modifying code
    By brawcliffe in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-13-2009, 12:08 PM
  4. Help modifying code please.
    By nickm687 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-24-2007, 10:42 AM
  5. [SOLVED] Modifying code to Consolidate only 1 column..
    By Darin Kramer in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-21-2006, 11:50 AM

Tags for this Thread

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