+ Reply to Thread
Results 1 to 11 of 11

Current code Inserts Rows below all examples of Value.....Need it to only do the last

  1. #1
    Forum Contributor
    Join Date
    04-23-2012
    Location
    Bradford PA
    MS-Off Ver
    Excel 2010
    Posts
    250

    Current code Inserts Rows below all examples of Value.....Need it to only do the last

    I have found and modified the following code to insert a row based on a combobox value.....the issue is it inserts it below all examples of this value in the database. I only want it to find the last example in column "B" and insert a new row below that.
    Please Login or Register  to view this content.
    Any help would be greatly appreciated.

  2. #2
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,653

    Re: Current code Inserts Rows below all examples of Value.....Need it to only do the last

    Please Login or Register  to view this content.
    Surround your VBA code with CODE tags e.g.;
    [CODE]your VBA code here[/CODE]
    The # button in the forum editor will apply CODE tags around your selected text.

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

    Re: Current code Inserts Rows below all examples of Value.....Need it to only do the last

    This should be much faster.

    Please Login or Register  to view this content.
    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.

  4. #4
    Forum Contributor
    Join Date
    04-23-2012
    Location
    Bradford PA
    MS-Off Ver
    Excel 2010
    Posts
    250

    Re: Current code Inserts Rows below all examples of Value.....Need it to only do the last

    Quote Originally Posted by mehmetcik View Post
    This should be much faster.

    Please Login or Register  to view this content.
    Thank you for the attemted help.....This actually inserts a row for each example of the combobox value at the end of the last example. So for example if there is 7 "A's" in column B it inserts 7 rows after the last "A" in Column B. I just want it to find the last "A" (i.e. prentending that "A" is the combobox value) and insert 1 row with the same format.

  5. #5
    Valued Forum Contributor WasWodge's Avatar
    Join Date
    08-02-2010
    Location
    Hampshire,England
    MS-Off Ver
    Office 365 and Office 2010
    Posts
    883

    Re: Current code Inserts Rows below all examples of Value.....Need it to only do the last

    What happens with...


    Please Login or Register  to view this content.
    Last edited by WasWodge; 06-26-2017 at 08:02 AM.
    If my solution worked (or not) please let me know. If your question is answered then please remember to mark it solved

    Computers are like air conditioners. They work fine until you start opening windows. ~Author Unknown

  6. #6
    Forum Contributor
    Join Date
    04-23-2012
    Location
    Bradford PA
    MS-Off Ver
    Excel 2010
    Posts
    250

    Re: Current code Inserts Rows below all examples of Value.....Need it to only do the last

    Quote Originally Posted by WasWodge View Post
    What happens with...


    Please Login or Register  to view this content.
    Unfortunately nothing but after reviewing a few times I can't figure out why as it seems to mirror what I was looking for. When I assign it to the commandbutton on the userform it does not do anything.

  7. #7
    Forum Guru xlnitwit's Avatar
    Join Date
    06-27-2016
    Location
    London
    MS-Off Ver
    Windows: 2010; Mac: 16.13 (O365)
    Posts
    7,085

    Re: Current code Inserts Rows below all examples of Value.....Need it to only do the last

    Hi,

    Did you try the code in post #2? It appears appropriate for what you asked for.
    Don
    Please remember to mark your thread 'Solved' when appropriate.

  8. #8
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,653

    Re: Current code Inserts Rows below all examples of Value.....Need it to only do the last

    Quote Originally Posted by jaredmccullough View Post
    Unfortunately nothing but after reviewing a few times I can't figure out why as it seems to mirror what I was looking for. When I assign it to the commandbutton on the userform it does not do anything.
    Remove the quotes
    Please Login or Register  to view this content.

  9. #9
    Valued Forum Contributor WasWodge's Avatar
    Join Date
    08-02-2010
    Location
    Hampshire,England
    MS-Off Ver
    Office 365 and Office 2010
    Posts
    883

    Re: Current code Inserts Rows below all examples of Value.....Need it to only do the last

    Quote Originally Posted by jaredmccullough View Post
    Unfortunately nothing but after reviewing a few times I can't figure out why as it seems to mirror what I was looking for. When I assign it to the commandbutton on the userform it does not do anything.
    Did you try it before or after the edit when I realised that you were putting "UserForm1.ComboBox1.Value " as a string when it shouldn't be? by your reply I say before.

  10. #10
    Forum Contributor
    Join Date
    04-23-2012
    Location
    Bradford PA
    MS-Off Ver
    Excel 2010
    Posts
    250

    Re: Current code Inserts Rows below all examples of Value.....Need it to only do the last

    Quote Originally Posted by xlnitwit View Post
    Hi,

    Did you try the code in post #2? It appears appropriate for what you asked for.
    Thank you for the response....I have tried post #2 but similar to post #5 when I apply it to the commandbutton in the userform it does not seem to do anything at all. I am currently evaluating to make sure that I there is not any naming issue but the combobox is as stated in the code.

  11. #11
    Forum Contributor
    Join Date
    04-23-2012
    Location
    Bradford PA
    MS-Off Ver
    Excel 2010
    Posts
    250

    Re: Current code Inserts Rows below all examples of Value.....Need it to only do the last

    Quote Originally Posted by AlphaFrog View Post
    Remove the quotes
    Please Login or Register  to view this content.
    For context of this post this was the correction that was needed......in which WasWodge fixed in Post #5. This update was exactly what I was looking for and I want to say thank you to both of you for your assistance on this. My apologies for any confusion as sometimes I catch things in the midst of others posting. I will marked as solved and again just wanted to reiterate my appreciation for the help.

    Jared

+ 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] Macro that evaluates rows of dates, inserts blank rows between different weeks
    By Wedge120 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 11-26-2014, 11:16 PM
  2. [SOLVED] Transpose Columns to Rows (automatically inserts new rows)
    By kichkichkich in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 04-28-2012, 05:38 AM
  3. code to insert rows and add total - inserts rows, but doesn't add
    By thole in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 05-06-2009, 04:25 PM
  4. VBA Code Examples
    By Christine in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-12-2006, 03:30 PM
  5. Looking for Userform examples - site on web, download examples
    By thom hoyle in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-10-2005, 01:06 PM
  6. [SOLVED] Examples of VBA code to scan all rows and perform a function conditionally?
    By pjfarley3 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 03-13-2005, 03:06 AM
  7. Replies: 1
    Last Post: 02-18-2005, 10:06 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