+ Reply to Thread
Results 1 to 4 of 4

Automatically assign a name to a range of cells not working when with only one entry

  1. #1
    Registered User
    Join Date
    05-13-2020
    Location
    Gulu, Uganda
    MS-Off Ver
    Professional Plus 2010
    Posts
    27

    Automatically assign a name to a range of cells not working when with only one entry

    Hi there,

    For a form I am using, I have the following code that allows to name the none empty cells of one column when I close the form. It work very well unless there is only one single entry (one row), which can happen for what I need the form for. Instead of just naming the single cell, the macro goes to the next none empty cell (which exists below but it concerns a different set of data). Is there a way to modify that code so that it select only one row if needed? In the case of the code below, it should be only cell H9.

    Please Login or Register  to view this content.
    Many thanks for your help, I have failed finding the answer on my own... (little VBA knowledge unfortunately)

  2. #2
    Forum Guru Kaper's Avatar
    Join Date
    12-14-2013
    Location
    Warsaw, Poland
    MS-Off Ver
    most often: Office 365 in Windows environment
    Posts
    8,606

    Re: Automatically assign a name to a range of cells not working when with only one entry

    So the issue is when H10 is empty. Then .end(xldown) leads you to any non empty cell in column H or even to last row in column H.

    Try such modification (I also got rid of select and then use selection - it is usually just slowing down the code excecution) :

    Please Login or Register  to view this content.
    Best Regards,

    Kaper

  3. #3
    Registered User
    Join Date
    05-13-2020
    Location
    Gulu, Uganda
    MS-Off Ver
    Professional Plus 2010
    Posts
    27

    Re: Automatically assign a name to a range of cells not working when with only one entry

    Works perfectly thank you very much!!

  4. #4
    Forum Guru Kaper's Avatar
    Join Date
    12-14-2013
    Location
    Warsaw, Poland
    MS-Off Ver
    most often: Office 365 in Windows environment
    Posts
    8,606

    Re: Automatically assign a name to a range of cells not working when with only one entry

    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED.

    Also, as a relatively new member of the forum, you may not be aware that you can thank those who have helped you by clicking the small star icon located in the lower left corner of the post in which the help was given. By doing so you can add to the reputation(s) of those who helped.

+ 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 - assign multiple objects within a given range to a range of cells with hyperlinks
    By RedBorg in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 03-17-2016, 02:46 AM
  2. Automatically Assign a Named Range Based on a Field
    By TeoneSofle in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-12-2014, 04:14 AM
  3. Validate that entry in one cell matches an entry in another range of cells
    By Grilleman in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 11-01-2014, 03:57 PM
  4. [SOLVED] Automatically move cells down after entry?
    By Ricksterr94 in forum Excel General
    Replies: 5
    Last Post: 08-01-2014, 04:46 PM
  5. Replies: 2
    Last Post: 01-24-2013, 07:59 AM
  6. Assign a Dropdown list to a range of cells from values of other range
    By kmlprtsngh in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-03-2011, 10:39 AM
  7. Replies: 2
    Last Post: 07-10-2006, 03:04 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