+ Reply to Thread
Results 1 to 10 of 10

Break long range into 2 code lines

  1. #1
    Forum Contributor
    Join Date
    06-16-2010
    Location
    Tampa, FL
    MS-Off Ver
    Excel 2010
    Posts
    278

    Break long range into 2 code lines

    I'm sure it's simple, I'm just not getting it - how do I break this into 2 code lines? It will not work as one line, probably too long, but I can't get it into 2. Currently I split it into 2 different ranges (check 1-10 then check 11-20). (I've tried the space _ the & " and a few other things)

    Please Login or Register  to view this content.
    What I really want to do is only spell check the groups (rows) that are visible - that would be a bonus

    Thanks!

  2. #2
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,168

    Re: Break long range into 2 code lines

    Hi ker9,
    How about

    Please Login or Register  to view this content.
    Or how about
    Please Login or Register  to view this content.
    Last edited by MarvinP; 01-12-2011 at 07:28 PM. Reason: Needed the Fill after Group No
    One test is worth a thousand opinions.
    Click the * Add Reputation below to say thanks.

  3. #3
    Forum Contributor
    Join Date
    06-16-2010
    Location
    Tampa, FL
    MS-Off Ver
    Excel 2010
    Posts
    278

    Re: Break long range into 2 code lines

    Hi,
    I get an error on both of them: Run time error 1004 - Application-defied or object-defined error
    This will run off a command button on a worksheet if that matters
    Thank you!

  4. #4
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: Break long range into 2 code lines

    Hello ker9,

    Your names "Group01Fill, Group02Fill, Group03Fill" etc. look to me like either column headings or named ranges. Which is it? Your answer will affect the coding for a solution.
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

  5. #5
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Break long range into 2 code lines

    Maybe the problem is just adding the rest of the range name to Marvin's code:
    Please Login or Register  to view this content.
    Entia non sunt multiplicanda sine necessitate

  6. #6
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,168

    Re: Break long range into 2 code lines

    Hi ker9

    My Bad, I forgot the "Fill" after the "Group" in the names.
    I've edited the above code so it might work now.

    Try it one more time.

    I'll give myself a demerit for not being careful enough to reread your exact post.

  7. #7
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,168

    Re: Break long range into 2 code lines

    I caught it too, but you posted first. Two demerits for me!!

  8. #8
    Forum Contributor
    Join Date
    06-16-2010
    Location
    Tampa, FL
    MS-Off Ver
    Excel 2010
    Posts
    278

    Re: Break long range into 2 code lines

    Hi,
    I tried this fix but get a run-time error
    CheckSpelling method of Range class failed

    Thanks to all for the assistance!

  9. #9
    Forum Contributor
    Join Date
    06-16-2010
    Location
    Tampa, FL
    MS-Off Ver
    Excel 2010
    Posts
    278

    Re: Break long range into 2 code lines

    Leith Ross - They are named ranges

  10. #10
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: Break long range into 2 code lines

    Hello ker9,

    The syntax for a named range in VBA is Range("Group01Fill"). To create a single range as in your example, your code would be...
    Please Login or Register  to view this content.

    A easier way is to loop through each range like this...
    Please Login or Register  to view this content.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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