+ Reply to Thread
Results 1 to 4 of 4

Code not moving focus to named range cell.

  1. #1
    Valued Forum Contributor
    Join Date
    01-16-2012
    Location
    England
    MS-Off Ver
    MS 365
    Posts
    1,169

    Code not moving focus to named range cell.

    Missing something simple on the attached Macro.

    Code works perfectly in finding first row on the DATABASE sheet with "0" in Col A (row 7), name that "FIRST", find the next "0" (Row 34), reset the end of the range to row 27, set that as "LAST", copy range to MASTER sheet and create a duplicate sheet which it renames.

    Please Login or Register  to view this content.
    I need it to go back to "LAST" and repeat the cycle, so the new "FIRST" and "LAST" become Rows 34 and 53, and then rows 60 - 75. Real sheet has 20k+ rows with ranges of variable lengths.

    Hope someone can see the obvious flaw?

    Ochimus
    Attached Files Attached Files

  2. #2
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Code not moving focus to named range cell.

    Please Login or Register  to view this content.
    should be:

    Please Login or Register  to view this content.
    If I've helped you, please consider adding to my reputation - just click on the liitle star at the left.

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~(Pride has no aftertaste.)

    You can't do one thing. XLAdept

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~aka Orrin

  3. #3
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    9,248

    Re: Code not moving focus to named range cell.

    An alternative way would be
    Please Login or Register  to view this content.
    The line in red changes the value in B3 to prevent naming sheets with an existing name

  4. #4
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,520

    Re: Code not moving focus to named range cell.

    Try this.
    Please Login or Register  to view this content.
    If posting code please use code tags, see here.

+ 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. Dynamic named range for columns...moving one column over
    By amartino44 in forum Excel General
    Replies: 7
    Last Post: 09-13-2013, 02:31 AM
  3. [SOLVED] Edit VBA code to select last cell in named range
    By rocksan in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 07-11-2012, 04:34 AM
  4. For Each cell in range and If statement. Prevent code moving on until If met
    By coasterman in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-29-2012, 11:28 AM
  5. Dynamic Named Range - Moving
    By jamesryan in forum Excel General
    Replies: 3
    Last Post: 05-01-2008, 08:53 AM
  6. Macro code to change cell range to named range
    By Orlic in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-25-2008, 11:51 AM
  7. TAB and focus moving from unprotected cell in protected sheet til dropdown.
    By Claus in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 08-26-2005, 07:05 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