+ Reply to Thread
Results 1 to 10 of 10

Excluding row from list

  1. #1
    Registered User
    Join Date
    02-10-2011
    Location
    California, USA
    MS-Off Ver
    Excel 2010
    Posts
    92

    Excluding row from list

    Hi,

    I have a list of competitors - the names are transferred from another sheet in Column B - with other columns for scores, totals etc. The number of competitors is set up for a maximum of 12 but changes from event to event

    Is there a way to eliminate the row if there is no name listed?

    Thanks.

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

    Re: Excluding row from list

    Hi Johnmus,

    We really need a sample of this problem to get close to solving it. Click on the Go Advanced button below the message area and then on the Paper Clip Icon above the message area to attach a file.
    One test is worth a thousand opinions.
    Click the * Add Reputation below to say thanks.

  3. #3
    Registered User
    Join Date
    02-10-2011
    Location
    California, USA
    MS-Off Ver
    Excel 2010
    Posts
    92

    Re: Excluding row from list

    I have found a macro to make this work

    Please Login or Register  to view this content.
    However I want to apply the maxcro to three different sheets. Sheet2, Sheet3, and Sheet4. How would I accomplish this?

    Also is there a way to start the macro when opening the worksheet?

    Should I have presented this to the VBA forum>

    Thanks
    Last edited by Johnmus; 03-10-2011 at 12:09 PM.

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

    Re: Excluding row from list

    Hi John,

    First - please edit your last message (the Green Edit under the message). Click on the "Go Advanced" under the message box, select all the code and click on the # icon above the message area. Then save the changes. This will put code tags around your code and will make the forum moderators happy.

    Your code will work on the active worksheet, so it will work on the sheet you are viewing.
    You can make it work whenever you "Activate" that worksheet by putting this code behind each of the worksheets you want it to trigger on.
    Please Login or Register  to view this content.
    hope this helps

  5. #5
    Registered User
    Join Date
    02-10-2011
    Location
    California, USA
    MS-Off Ver
    Excel 2010
    Posts
    92

    Re: Excluding row from list

    Thanks for explaining the code tags!

    Appreciate the help.

  6. #6
    Registered User
    Join Date
    02-10-2011
    Location
    California, USA
    MS-Off Ver
    Excel 2010
    Posts
    92

    Re: Excluding row from list

    Hi,

    I hope you can help me solve this problem. I have a competition spreadsheet with a event info form where I list the competitors. This changes from week to week, so the list in the Event form is blank until we know who is competing. I am using this macro to hide to unnessary rows and also use an unhide macro just in case we need to make adjustments.

    What I want to accomplish is that when I open the event info sheet and type in the names, the empty rows on the next sheets - there are three sheets (sheet1,sheet2,sheet3) - are hidden once I acces those sheets to put in the numbers.

    Here is the code
    Please Login or Register  to view this content.
    This works but I have to access each sheet to run the macro. I tried adding the activate code above but that did not work.

    Thanks for any help!
    Last edited by Johnmus; 03-11-2011 at 01:09 PM.

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

    Re: Excluding row from list

    Hi John,

    I believe there is some confusion between Code Behind a Sheet and Code In A Module.
    The code behind a sheet is event code that works on that individual sheet. Code in a module can work on any sheet. I believe you need your above code in a module. Then while looking at a sheet (this would be your activesheet) you run the above code (from a module). The code will then work on the active sheet.

    I believe this is the problem. If you could attach a sample workbook we could better understand where you code lives and why it isn't acting like you expect.

  8. #8
    Registered User
    Join Date
    02-10-2011
    Location
    California, USA
    MS-Off Ver
    Excel 2010
    Posts
    92

    Re: Excluding row from list

    Hi,

    I've got everything working really well with the following Code

    Please Login or Register  to view this content.
    Now when I type the names of the competitors in the event sheet all empty rows will be hidden. The macro activates automatically but I've assigned Ctrl h to execute the hiding function and Ctrl u to execute the unhiding function. The sheet will also protect and unprotect with the macro.
    I am just beginning with VBA and the problem I need to solve is the awards sheet will show #NUM! or #N/A or 0.00 because some formulas are responsing to 0 for not used entries.I would like to be able to also hide these upon activating the sheet.

    On the Awards sheet I also cannot hide with the shortcut Ctrl h - Unhide, Ctrl u works fine

    I am attaching a shortened version of the workbook.

    Thanks for your help.
    Last edited by Johnmus; 03-18-2011 at 01:09 AM.

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

    Re: Excluding row from list

    Hi Johnmus,

    Ctrl-H is reserved for the Find and Replace dialog box. See http://office.microsoft.com/en-gb/ex...001111659.aspx

    I'm concerned that you have your code in the ThisWorkbook. You should INSERT a MODULE and put most of your code in it. Read the first sentence of http://www.cpearson.com/excel/codemods.htm

  10. #10
    Registered User
    Join Date
    02-10-2011
    Location
    California, USA
    MS-Off Ver
    Excel 2010
    Posts
    92

    Re: Excluding row from list

    I have inserted a Module and put most of the code in there, but also in the individual worksheets. This seems to work very well as the range varies from sheet to sheet. I am using Ctrl u to unhide rows if necessary.

    At times the code seems to slow down the entire process.

    Thanks for your help! It is much appreciated.

    John

+ 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