+ Reply to Thread
Results 1 to 7 of 7

Check Range and Exclude Column

  1. #1
    Registered User
    Join Date
    06-14-2021
    Location
    Hendersonville, NC
    MS-Off Ver
    365
    Posts
    3

    Check Range and Exclude Column

    I have a macro that checks the range B2:E for cells that are blank. When the user clicks a button the macro runs and fills the cell with red. I want to check columns B, D, and E but not C because C is an optional field.

    The problem I am having is that it seems to be working except it is also formatting column C by filling it with red, the column I wanted to exclude.

    I do not want to use conditional formatting.

    My code is below

    Please Login or Register  to view this content.

  2. #2
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,445

    Re: Check Range and Exclude Column

    Maybe like this:

    Please Login or Register  to view this content.
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  3. #3
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,445

    Re: Check Range and Exclude Column

    Rewritten code:

    Please Login or Register  to view this content.

  4. #4
    Registered User
    Join Date
    06-14-2021
    Location
    Hendersonville, NC
    MS-Off Ver
    365
    Posts
    3

    Re: Check Range and Exclude Column

    Thank you! This worked beautifully
    Last edited by splunk76; 06-15-2021 at 09:21 AM.

  5. #5
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,445

    Re: Check Range and Exclude Column

    Please attach a sample workbook (not a picture or pasted copy). Make sure there is just enough data to demonstrate your need. Include a BEFORE sheet and an AFTER sheet in the workbook if needed to show the process you're trying to complete or automate. Make sure your desired results are shown, mock them up manually if necessary.

    Remember to desensitize the data.

    Click on GO ADVANCED and then scroll down to Manage Attachments to open the upload window.

  6. #6
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,445

    Re: Check Range and Exclude Column

    I'm confused … I thought you said it failed, but you've edited the post.


    If you are satisfied with the solution(s) provided, please mark your thread as Solved.


    New quick method:
    Select Thread Tools-> Mark thread as Solved. To undo, select Thread Tools-> Mark thread as Unsolved.

    Or you can use this way:

    How to mark a thread Solved
    Go to the first post
    Click edit
    Click Go Advanced
    Just below the word Title you will see a dropdown with the word No prefix.
    Change to Solved
    Click Save


    You may also want to consider thanking those people who helped you by clicking on the little star at the bottom left of their reply to your question.

  7. #7
    Registered User
    Join Date
    06-14-2021
    Location
    Hendersonville, NC
    MS-Off Ver
    365
    Posts
    3

    Re: Check Range and Exclude Column

    Will do!

    I do have a related question. I want to add this logic on the Before Close event, but since the sheets are protected I am running into an issue with the portion

    I get the error message that I cannot use that command on a protected sheet. I know the password, but when I try to unprotect the sheet it doesn't work and gives me an out of range error

    Set rTest = rInterest.SpecialCells(xlCellTypeBlanks)

+ 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] Exclude Column from Data Range in Formula
    By commerjare in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 10-01-2019, 04:42 PM
  2. [SOLVED] check value = 0 in column range
    By brainzlp in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 08-08-2015, 07:16 PM
  3. check value = 0 in column range
    By brainzlp in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-08-2015, 05:37 PM
  4. check value = 0 in column range
    By brainzlp in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-08-2015, 05:35 PM
  5. [SOLVED] VBA exclude column within range
    By syedmehdi in forum Excel General
    Replies: 2
    Last Post: 03-06-2015, 08:08 AM
  6. Check Column for duplicate range
    By tgasexcel in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 12-23-2013, 12:32 PM
  7. Formula to Check Column A for date range and count Column B
    By realniceguy5000 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 10-28-2009, 12:58 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