+ Reply to Thread
Results 1 to 7 of 7

Insert "-" In Other Cells On The Same Row If Cell Value Is "SPARE"

  1. #1
    Forum Contributor
    Join Date
    01-12-2012
    Location
    UK
    MS-Off Ver
    Excel 2016
    Posts
    104

    Insert "-" In Other Cells On The Same Row If Cell Value Is "SPARE"

    Hi All,

    I have the code below, but it takes a long time to complete because of the repetitive actions.
    Is there a way to make it more efficient?

    Please Login or Register  to view this content.
    Any help would be greatly appreciated!

    Thanks,
    Storm08
    Attached Files Attached Files
    Last edited by Storm08; 11-09-2022 at 06:39 AM.

  2. #2
    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
    44,502

    Re: Insert "-" In Other Cells On The Same Row If Cell Value Is "SPARE"

    Fast answers need visual help. Please read the yellow banner at the top of this page on how to attach a file and a mocked up solution.

    Showing extracts of codes isn't as helpful as you might think. Problems raises more questions than answers.
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    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


  3. #3
    Forum Contributor
    Join Date
    01-12-2012
    Location
    UK
    MS-Off Ver
    Excel 2016
    Posts
    104

    Re: Insert "-" In Other Cells On The Same Row If Cell Value Is "SPARE"

    Thanks for the response.

    Sheet has been added to the original post.

  4. #4
    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
    44,502

    Re: Insert "-" In Other Cells On The Same Row If Cell Value Is "SPARE"

    This seems to work quicker:

    Please Login or Register  to view this content.

  5. #5
    Forum Contributor
    Join Date
    01-12-2012
    Location
    UK
    MS-Off Ver
    Excel 2016
    Posts
    104

    Re: Insert "-" In Other Cells On The Same Row If Cell Value Is "SPARE"

    Hi TMS,

    Thanks for the solution.

    That definitely works a lot quicker than previously! However, is there a way to exclude some of the columns from the For loop?
    The original code doesn't apply it to each cell in the row, it skips some.

  6. #6
    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
    44,502

    Re: Insert "-" In Other Cells On The Same Row If Cell Value Is "SPARE"

    Difficult to assess. You have all those merged cells, always a (very, very) bad thing.

    The choices are:
    1. Loop through all the individual cells (original and slow)
    2. Fill all the cells in one go (as suggested and quicker)
    3. Combine the options. Group the cells by adjusting the offset and resize values.

    To be honest, when you refer to C4.Offset(,1) in relation to a merged cell, I’m not entirely sure which cell it means.

  7. #7
    Forum Contributor
    Join Date
    01-12-2012
    Location
    UK
    MS-Off Ver
    Excel 2016
    Posts
    104

    Re: Insert "-" In Other Cells On The Same Row If Cell Value Is "SPARE"

    Hi TMS,

    Apologies for the severe delay!

    I know merged cells are generally bad news, but I can't do much to get away from them on this occasion.
    When you mention adjusting the offset/resize values, how would I go about trying this?

    +Rep!

    Cheers,
    Storm

+ 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. Replies: 5
    Last Post: 02-05-2019, 12:03 AM
  2. Replies: 3
    Last Post: 05-02-2018, 08:03 AM
  3. [SOLVED] Column X-Ref list - Sheet1 Col A "pages", Col B:FL "Req" to Sheet2 ColA "req", ColB "page"
    By excel-card-pulled in forum Excel Formulas & Functions
    Replies: 10
    Last Post: 04-07-2017, 09:30 AM
  4. Replies: 4
    Last Post: 11-17-2013, 12:05 PM
  5. [SOLVED] How to USE """"" cells count """"" change font color
    By austin123456 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 10-09-2013, 06:14 AM
  6. [SOLVED] Data validation: allow entry into a cell if other three cells have "X", "Y" and "Z"?
    By RogerRangeRover in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 01-05-2013, 04:49 AM
  7. Insert 19 cells "Shift to the right" if cell contains "->"
    By robertjtucker in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 07-25-2005, 11:20 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