+ Reply to Thread
Results 1 to 21 of 21

Last row of same character

  1. #1
    Forum Contributor KBSH's Avatar
    Join Date
    09-16-2015
    Location
    Netherlands
    MS-Off Ver
    2013
    Posts
    113

    Last row of same character

    Im trying to find the code for the next example:

    On the picture in column "A" there are several characters wich are the same. The code should be able to select all rows with that same character and observer that it's continuously. So the rows containing an "x" in the red zone should not be selected.
    Knipsel.JPG
    I'm mediocre with VBA, but getting there

  2. #2
    Forum Contributor KBSH's Avatar
    Join Date
    09-16-2015
    Location
    Netherlands
    MS-Off Ver
    2013
    Posts
    113

    Re: Last row of same character

    Something like:
    Please Login or Register  to view this content.
    won't work

    Something like
    Please Login or Register  to view this content.
    does seem to work, though I need a small adjustment on this code that selects not only the last cell, but the other ones aswell.
    Last edited by KBSH; 03-01-2016 at 04:22 PM.

  3. #3
    Registered User
    Join Date
    12-14-2012
    Location
    Czech Republic
    MS-Off Ver
    Excel 2010
    Posts
    92

    Re: Last row of same character

    Hello friend,

    this my first post actually... my first try of code posting here. So hello KBHS & everyone..

    Looking at it now seems my code a bit complicated then your examples. It is a pure loop of each cell and comparing its values.

    Try this if it can help you in some way...

    Please Login or Register  to view this content.

    Thanks
    sysss
    Last edited by sysss; 03-01-2016 at 05:25 PM.

  4. #4
    Forum Expert
    Join Date
    07-31-2010
    Location
    California
    MS-Off Ver
    Excel 2007
    Posts
    4,070

    Re: Last row of same character

    Try this

    Please Login or Register  to view this content.
    If you are happy with my response please click the * in the lower left of my post.

  5. #5
    Forum Contributor amartinez988's Avatar
    Join Date
    05-04-2015
    Location
    Miami
    MS-Off Ver
    Office 2010
    Posts
    183

    Re: Last row of same character

    Check if you can get something out of this

    Please Login or Register  to view this content.

  6. #6
    Forum Contributor amartinez988's Avatar
    Join Date
    05-04-2015
    Location
    Miami
    MS-Off Ver
    Office 2010
    Posts
    183

    Re: Last row of same character

    stnkynts,

    Using areas is a great and fast solution.

    Thanks for the option

  7. #7
    Forum Guru Winon's Avatar
    Join Date
    02-20-2007
    Location
    East Rand, R.S.A.
    MS-Off Ver
    2010
    Posts
    6,113

    Re: Last row of same character

    Hello sysss,

    Welcome to the Forum.

    I think your Code is great! With a few changes it now works like this:

    Please Login or Register  to view this content.
    Regards.
    Please consider:

    Be polite. Thank those who have helped you. Then Click on the star icon in the lower left part of the contributor's post and add Reputation. Cleaning up when you're done. If you are satisfied with the help you have received, then Please do Mark your thread [SOLVED] .

  8. #8
    Forum Expert
    Join Date
    07-31-2010
    Location
    California
    MS-Off Ver
    Excel 2007
    Posts
    4,070

    Re: Last row of same character

    Quote Originally Posted by amartinez988 View Post
    stnkynts,

    Using areas is a great and fast solution.

    Thanks for the option
    Welcome. Thanks for the rep .

  9. #9
    Registered User
    Join Date
    12-14-2012
    Location
    Czech Republic
    MS-Off Ver
    Excel 2010
    Posts
    92

    Re: Last row of same character

    Hello Winon,

    and thank you very much. This is really nice place to learn.
    I like your changes and the other solutions as well.

    Have a good day
    sysss

  10. #10
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,525

    Re: Last row of same character

    Different method.
    Please Login or Register  to view this content.
    Last edited by jindon; 03-02-2016 at 12:18 AM.

  11. #11
    Forum Contributor KBSH's Avatar
    Join Date
    09-16-2015
    Location
    Netherlands
    MS-Off Ver
    2013
    Posts
    113

    Re: Last row of same character

    Thanks people for the great help!

  12. #12
    Forum Contributor amartinez988's Avatar
    Join Date
    05-04-2015
    Location
    Miami
    MS-Off Ver
    Office 2010
    Posts
    183

    Re: Last row of same character

    Great!

    Please don't forget to mark the post as SOLVED and add reputation to members that helped you.

    Thanks,

  13. #13
    Forum Contributor KBSH's Avatar
    Join Date
    09-16-2015
    Location
    Netherlands
    MS-Off Ver
    2013
    Posts
    113

    Re: Last row of same character

    Quote Originally Posted by Winon View Post
    Hello sysss,

    Welcome to the Forum.

    I think your Code is great! With a few changes it now works like this:

    Please Login or Register  to view this content.
    Regards.
    This code does exactly what it needs to do!! However it's a bit complex and I would like it to be very simplified (no msgboxes and stuff) and I would like the code to be concerning only about a continuous range beside a cell. I want to make a sheet like the one in the attachment that contains rows that can be moved upwards or downwards by the push of a button. I know it will be hard, but I'll try to do it myself, but it would be nice if someone could help me with this. I'm already experimenting with spinbuttons. The code doesn't need to be working with colors btw.
    Attached Files Attached Files
    Last edited by KBSH; 03-02-2016 at 02:30 PM.

  14. #14
    Forum Contributor KBSH's Avatar
    Join Date
    09-16-2015
    Location
    Netherlands
    MS-Off Ver
    2013
    Posts
    113

    Re: Last row of same character

    For the starting position of the continuous range I'm thinking about something like:
    Please Login or Register  to view this content.
    Edit:

    Please Login or Register  to view this content.
    Edit 2:
    Please Login or Register  to view this content.
    This code doesn't work....

    Sorry if I wasn't clear on what I wanted
    Last edited by KBSH; 03-02-2016 at 03:41 PM. Reason: I will keep updating my quest :)

  15. #15
    Forum Guru Winon's Avatar
    Join Date
    02-20-2007
    Location
    East Rand, R.S.A.
    MS-Off Ver
    2010
    Posts
    6,113

    Re: Last row of same character

    Hi KBSH,

    Thank you for the feedback.

    Your sample workbook with all the Buttons, somehow made me believe we might be looking at fixed Ranges, but then again I think, just maybe you are over complicating things a little bit.

    To illustrate my point, please try the "Try Me !" Button on the attached sample Workbook.

    Regards.
    Attached Files Attached Files

  16. #16
    Forum Contributor KBSH's Avatar
    Join Date
    09-16-2015
    Location
    Netherlands
    MS-Off Ver
    2013
    Posts
    113

    Re: Last row of same character

    Thanks for your input....we are getting close. I'll upload a very simplified and halfway translated version of what I'm working on, so you'll understand what my problem is.

    Just push on the buttons and you will see what happens..... I want the inserted ranges to be portable....I've already made them expandable.

    I've quickly altered the code in that attachement so it's possible that some stuff doesn't work the way it should work.

    I don't think that I'm overcomplicating things...this really is a challange.

    Edit: attachement removed
    Last edited by KBSH; 03-02-2016 at 05:04 PM.

  17. #17
    Forum Contributor KBSH's Avatar
    Join Date
    09-16-2015
    Location
    Netherlands
    MS-Off Ver
    2013
    Posts
    113

    Re: Last row of same character

    Please Login or Register  to view this content.
    is the code that I think has to be used for the newly created buttons or in my case
    Please Login or Register  to view this content.
    In your code the buttons get named....that would not be possible in my case.
    Last edited by KBSH; 03-02-2016 at 04:33 PM.

  18. #18
    Forum Guru Winon's Avatar
    Join Date
    02-20-2007
    Location
    East Rand, R.S.A.
    MS-Off Ver
    2010
    Posts
    6,113

    Re: Last row of same character

    Hi KBSH,

    Hokaai, komen we nemen het stap voor stap. Is de laatste Workbook wat ik voor u gezonden heeft, recht voor je?

    Your newly uploaded Workbook appears to be a major deviation from your original issue.

    Please could you confirm that your original issue has been addressed or solved.

    Ik ga nu eerst slapen, en zal more weer met je praten.

    Groete.

  19. #19
    Forum Contributor KBSH's Avatar
    Join Date
    09-16-2015
    Location
    Netherlands
    MS-Off Ver
    2013
    Posts
    113

    Re: Last row of same character

    Haha

    I wanted to solve the problem myself so I only posted small parts of my entire problem. As I'm not that advanced with VBA yet and only able to alter codes instead of making them, this is a huge challenge for me. I don't even know whether it's even possible to do what I want.

    I really appreciate your help though.

    Sleep well

    I'll upload an even more simplified version so stuff doesn't distract from the real problem.
    Attached Files Attached Files
    Last edited by KBSH; 03-02-2016 at 05:03 PM.

  20. #20
    Forum Guru Winon's Avatar
    Join Date
    02-20-2007
    Location
    East Rand, R.S.A.
    MS-Off Ver
    2010
    Posts
    6,113

    Re: Last row of same character

    Hi KBSH,

    Post No. 18 refers.

    I am still awaiting you reply to:

    Please could you confirm that your original issue has been addressed or solved.
    Regards.

  21. #21
    Forum Contributor KBSH's Avatar
    Join Date
    09-16-2015
    Location
    Netherlands
    MS-Off Ver
    2013
    Posts
    113

    Re: Last row of same character

    Hey

    Yeah I guess you're right. When I'm at home I will open a new thread. I will mark this as solved.

+ 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 to rename cell content based on the starting character until found same character
    By oeyandyprawira in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 09-19-2015, 09:36 AM
  2. Replies: 4
    Last Post: 08-26-2014, 09:20 AM
  3. [SOLVED] find the character position in a string of the last occurrence of a nominated character
    By jmac1947 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-04-2014, 11:52 PM
  4. Replies: 3
    Last Post: 11-20-2012, 10:03 PM
  5. Macro to find character and delete all text in cell after the character
    By SpencerRichman in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-01-2012, 06:08 PM
  6. Display Active Character Count + Limit Character Per Cell
    By euronail in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-22-2011, 04:59 AM
  7. [SOLVED] importing undelimited text file data, character-by-character
    By The Mos$ in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 12-26-2005, 07:10 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