+ Reply to Thread
Results 1 to 9 of 9

Code to run to currently populated cells

  1. #1
    Forum Contributor
    Join Date
    05-01-2015
    Location
    Kent, England
    MS-Off Ver
    2013
    Posts
    148

    Code to run to currently populated cells

    Hi all

    I am using the following code to insert two new columns and then put the weeknum and L2 in each, and then delete an unwanted cell, my question is that my data sped changes each week this week it had 198 next week it may only be 180 or 80 how do i change the code so it only goes as far as whats in cells C.
    I am new to this and trying to learn as i go so any help would be good.

    Thanks you.

    Please Login or Register  to view this content.
    Last edited by OillyBob55; 04-23-2017 at 04:25 PM.

  2. #2
    Forum Expert
    Join Date
    12-14-2012
    Location
    London England
    MS-Off Ver
    MS 365 Office Suite.
    Posts
    8,448

    Re: Code to run to currently populated cells

    Sorry Friend

    I cannot help until you insert code tags.



    Your post does not comply with Rule 3 of our Forum RULES. Use code tags around code.

    Posting code between [CODE]Please [url=https://www.excelforum.com/login.php]Login or Register [/url] to view this content.[/CODE] tags makes your code much easier to read and copy for testing, it also maintains VBA formatting.

    Click on Edit to open your thread, then highlight your code and click the # icon at the top of your post window. More information about these and other tags can be found here

    (This thread should receive no further responses until this moderation request is fulfilled, as per Forum Rule 7)
    My General Rules if you want my help. Not aimed at any person in particular:

    1. Please Make Requests not demands, none of us get paid here.

    2. Check back on your post regularly. I will not return to a post after 4 days.
    If it is not important to you then it definitely is not important to me.

  3. #3
    Forum Contributor
    Join Date
    05-01-2015
    Location
    Kent, England
    MS-Off Ver
    2013
    Posts
    148

    Re: Code to run to currently populated cells

    Sorry about that. i have done as requested.

    Thanks

  4. #4
    Forum Expert
    Join Date
    12-14-2012
    Location
    London England
    MS-Off Ver
    MS 365 Office Suite.
    Posts
    8,448

    Re: Code to run to currently populated cells

    First lets tidy up your existing code.


    Please Login or Register  to view this content.


    Now lets modify it to find the last used row in column A, Column C when you insert 2 columns and only work to that row.

    Please Login or Register  to view this content.
    Last edited by mehmetcik; 04-23-2017 at 06:54 PM.

  5. #5
    Forum Contributor
    Join Date
    05-01-2015
    Location
    Kent, England
    MS-Off Ver
    2013
    Posts
    148

    Re: Code to run to currently populated cells

    wow ok thats a lot tidier

  6. #6
    Forum Contributor
    Join Date
    05-01-2015
    Location
    Kent, England
    MS-Off Ver
    2013
    Posts
    148

    Re: Code to run to currently populated cells

    That's great thank you its easy when you know how, i am still learning as i go and that's a real help.

    Thanks

  7. #7
    Forum Contributor
    Join Date
    05-01-2015
    Location
    Kent, England
    MS-Off Ver
    2013
    Posts
    148

    Re: Code to run to currently populated cells

    I am getting an error when i run it

    Run-Time Error '1004':

    Method'Range'of object'_Global' Failed.

    Its putting the two columns in A and B but failing in populating them.

    Please Login or Register  to view this content.

  8. #8
    Forum Expert
    Join Date
    12-14-2012
    Location
    London England
    MS-Off Ver
    MS 365 Office Suite.
    Posts
    8,448

    Re: Code to run to currently populated cells

    Sorry typo. just corrected it

  9. #9
    Forum Contributor
    Join Date
    05-01-2015
    Location
    Kent, England
    MS-Off Ver
    2013
    Posts
    148

    Re: Code to run to currently populated cells

    Thanks thats solved it
    Last edited by OillyBob55; 04-23-2017 at 07:04 PM.

+ 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] VBA code not to continue Macro unless unless all relative cells populated
    By bdouglas1011 in forum Excel Programming / VBA / Macros
    Replies: 38
    Last Post: 09-02-2014, 12:27 PM
  2. Delete Cells with Specific Value and All Blank Cells Until Next Populated Cell is Checked
    By rdtrahan1906 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-26-2014, 05:50 PM
  3. [SOLVED] VBA help to limit code application to populated cells
    By shootstill in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 04-28-2014, 06:13 PM
  4. [SOLVED] How can I modify my current code to not change once populated
    By Dena in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 09-05-2013, 01:52 PM
  5. 2010 VBA Code for: format the print area to include only rows with populated cells
    By sambo24 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 06-19-2013, 10:57 AM
  6. Replies: 4
    Last Post: 01-31-2012, 01:08 PM
  7. [SOLVED] Conditional formulas: color code text populated cells?
    By TKT in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 10-28-2005, 10:05 PM

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