+ Reply to Thread
Results 1 to 9 of 9

VBA to find next unused cell in Named Range

  1. #1
    Forum Contributor
    Join Date
    11-08-2017
    Location
    Murfreesboro, TN
    MS-Off Ver
    MS 365
    Posts
    168

    VBA to find next unused cell in Named Range

    Hi.

    I have a named range of non-contiguous cells called "MainCategory". How can I write VBA to find the next blank cell in that range?

    Thanks!

  2. #2
    Forum Expert MickG's Avatar
    Join Date
    11-23-2007
    Location
    Banbury,Oxfordshire
    Posts
    2,650

    Re: VBA to find next unused cell in Named Range

    Try this:-
    Please Login or Register  to view this content.
    Regards Mick

  3. #3
    Forum Expert dangelor's Avatar
    Join Date
    09-06-2011
    Location
    Indiana, USA
    MS-Off Ver
    365 Pro Plus
    Posts
    2,274

    Re: VBA to find next unused cell in Named Range

    Possibly...
    Please Login or Register  to view this content.

  4. #4
    Valued Forum Contributor
    Join Date
    10-15-2007
    Location
    Home
    MS-Off Ver
    Office 2010, W10
    Posts
    373

    Re: VBA to find next unused cell in Named Range

    Hi

    Remark:

    xlCellTypeBlanks means just empty cells.

    @LKERN What do you mean by blank? Do you mean an empty cell or also a cell with a null string?

  5. #5
    Forum Contributor
    Join Date
    11-08-2017
    Location
    Murfreesboro, TN
    MS-Off Ver
    MS 365
    Posts
    168

    Re: VBA to find next unused cell in Named Range

    Thanks MickG.

    This finds the blank cell and puts up a message box of the cell address, but when I hit OK, it just goes to the next box. I can't get out of the loop until I OK every msg.

    I just want it to find the first blank cell and stop there. Also, what can I change to make it navigate to that cell instead of showing a message box?

  6. #6
    Forum Contributor
    Join Date
    11-08-2017
    Location
    Murfreesboro, TN
    MS-Off Ver
    MS 365
    Posts
    168

    Re: VBA to find next unused cell in Named Range

    Quote Originally Posted by lecxe View Post
    Hi

    Remark:

    xlCellTypeBlanks means just empty cells.

    @LKERN What do you mean by blank? Do you mean an empty cell or also a cell with a null string?
    I'm not sure how to answer. The cells in the range have a data validation list to choose from and they default to a blank cell. I want it to choose the first cell that does not have anything chosen from the list.

  7. #7
    Forum Contributor
    Join Date
    11-08-2017
    Location
    Murfreesboro, TN
    MS-Off Ver
    MS 365
    Posts
    168

    Re: VBA to find next unused cell in Named Range

    Quote Originally Posted by dangelor View Post
    Possibly...
    Please Login or Register  to view this content.
    I tried this and I get an error that says:Attachment 636209

  8. #8
    Forum Contributor
    Join Date
    11-08-2017
    Location
    Murfreesboro, TN
    MS-Off Ver
    MS 365
    Posts
    168

    Re: VBA to find next unused cell in Named Range

    Wait....I got it to work like this:

    Please Login or Register  to view this content.
    Thanks!

  9. #9
    Forum Expert dangelor's Avatar
    Join Date
    09-06-2011
    Location
    Indiana, USA
    MS-Off Ver
    365 Pro Plus
    Posts
    2,274

    Re: VBA to find next unused cell in Named Range

    Glad to hear it!

+ 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. VBA code to find cell contents within named range, copy to new row on another sheet
    By djarum11 in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 02-23-2015, 11:17 PM
  2. [SOLVED] vba to find the first unused value in a range
    By hemiceni in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 10-21-2014, 09:26 PM
  3. Code to find named range doesn't find the correct field range?
    By matrixpom in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 11-12-2012, 05:54 PM
  4. Find max value in named range and put this + 1 in active cell
    By mlun in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-02-2012, 11:55 AM
  5. Find out what named range a cell is part of
    By pizzett in forum Excel General
    Replies: 1
    Last Post: 07-25-2007, 10:44 AM
  6. Unused Named Cells
    By beetlejuice1976 in forum Excel General
    Replies: 1
    Last Post: 06-15-2007, 02:29 PM
  7. [SOLVED] Find first blank cell in single column named range
    By tig in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 02-09-2006, 01:40 PM

Tags for this Thread

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