Handling blank RedEdits

  • MODERATOR NOTICE: This topic has also been posted on other sites and may already have an answer elsewhere. Please take this into consideration when answering this question

    At least one cross post here

    How can I ignore a blank RefEdit when adding ranges? I have the following:

    This works perfectly if all RefEdits are populated, but nothing happens if one is missing. I can add an "On Error Resume Next", but that doesn't address the problem that no output is shown. How can I say "If Rng1, Rng2, or Rng3 are blank, exclude from calculation"?

  • Maybe

  • It's not clear what your variables are, but try this

  • Thanks again, Roy!

    The purpose of the macro is to allow the user to select any number of columns and sum them up. Assuming that there will always be 3 columns for the user to select, and that the user selects 2 out of the three, what code would be equivalent to "still perform calculation even if not all three columns are selected"?

    Right now, the output of "Totals" is blank if not all three columns are selected.

    The indicies and header names of the columns I want to evaluate vary by sheet, so I had to resort to refedit to give the user the flexibility to select the correct columns.

  • Try this

  • Try this. it also puts the column header on the left

  • This amendment adds currency formatting and autofits the two columns