+ Reply to Thread
Results 1 to 12 of 12

Need Help Altering Code

  1. #1
    Registered User
    Join Date
    08-19-2013
    Location
    New York, NY
    MS-Off Ver
    Excel 2003
    Posts
    77

    Need Help Altering Code

    I have the following Code:
    Please Login or Register  to view this content.
    Right now it inserts a Row when the values in Column A dont match. I need it to do this but to also start from the last known value in Column A because it stops once it reaches an empty cell and after it inserts the row it runs into an empty cell which stops the macro. Also I have color Values on some of the cells. So when it inserts a new row it carries over the color value. Is there a way to insert a blank row? Thanks for any help.

  2. #2
    Registered User
    Join Date
    09-03-2014
    Location
    Lakewood, Ohio
    MS-Off Ver
    Office 365
    Posts
    12

    Re: Need Help Altering Code

    Just giving this a quick look.
    I think you need another rows = rows + 1 before the Else
    so
    Cells(rowx + 1, 1).EntireRow.Insert
    rowx = rowx + 1
    Else
    rowx = rowx + 1

    That might solve the first problem

  3. #3
    Forum Contributor
    Join Date
    06-15-2013
    Location
    United States
    MS-Off Ver
    Excel 2016
    Posts
    213

    Re: Need Help Altering Code

    That's what I thought also but that ended up freezing my program for some reason.

  4. #4
    Registered User
    Join Date
    09-03-2014
    Location
    Lakewood, Ohio
    MS-Off Ver
    Office 365
    Posts
    12

    Re: Need Help Altering Code

    Have you declared the variable.
    try
    Sub InsertBottomRow()
    Dim rowx As Long
    Range("A3").Select

  5. #5
    Registered User
    Join Date
    08-19-2013
    Location
    New York, NY
    MS-Off Ver
    Excel 2003
    Posts
    77

    Re: Need Help Altering Code

    Thanks LiveAptly.com I've tried both of those options but nothing has worked for me.

  6. #6
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Need Help Altering Code

    Another option:

    Please Login or Register  to view this content.

  7. #7
    Registered User
    Join Date
    08-19-2013
    Location
    New York, NY
    MS-Off Ver
    Excel 2003
    Posts
    77

    Re: Need Help Altering Code

    Thanks John that almost works the way i need it. I included a sample Sheet. Column A shows the type of information I'm dealing with. Column C shows how I would like it to look after a new row is inserted.

    TestShift.xlsx

  8. #8
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Need Help Altering Code

    Oops. My mistake.

    Please Login or Register  to view this content.

  9. #9
    Registered User
    Join Date
    08-19-2013
    Location
    New York, NY
    MS-Off Ver
    Excel 2003
    Posts
    77

    Re: Need Help Altering Code

    Thanks John that works. Just one last thing from my original question. Is there a way to make the new row clear since it will sometimes carry over the color value in the row above?

  10. #10
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Need Help Altering Code

    Try:

    Please Login or Register  to view this content.

  11. #11
    Registered User
    Join Date
    08-19-2013
    Location
    New York, NY
    MS-Off Ver
    Excel 2003
    Posts
    77

    Re: Need Help Altering Code

    Thank you that works.

  12. #12
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Need Help Altering Code

    You're welcome. Glad to help out and thanks for the feedback.

+ 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] Altering existing formulas using VBA code
    By TheRobsterUK in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 03-14-2014, 11:35 AM
  2. Altering existing macro code
    By jsmity in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 08-03-2010, 01:05 PM
  3. Altering Range in Code
    By Janc in forum Excel Charting & Pivots
    Replies: 4
    Last Post: 11-02-2009, 07:27 AM
  4. altering URLs with code
    By imimin in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-23-2006, 12:45 AM
  5. [SOLVED] Altering code to accomodate empty space
    By JOUIOUI in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-28-2006, 12:20 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