Results 1 to 7 of 7

Thread: hyphen in code

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #5
    Knowledge Base Approver VBAX Wizard p45cal's Avatar
    Joined
    Oct 2005
    Location
    Surrey UK
    Posts
    5,970
    Change each instance of:
    If .Cells(iGender).Value =
    to:
    If Cells(2,iGender).Value =
    Note the missing dot before Cells.
    This is because the Male or Female value only occurs in one cell in the entire sheet, not on each row.

    Other points, your:
    For iRow = 2 To rData.Rows.Count
    I think should be:
    For iRow = 4 To rData.Rows.Count

    You have at least 4 pairs of lines like:
    If .Cells(iInheritance).Value = "autosomal dominant" And .Cells(iPopFreqMax).Value <= 0.01 And .Cells(iClinvar).Value = "" And .Cells(iCommon).Value = "" Then .Cells(iClassification).Value = "likely pathogenic"
    If .Cells(iInheritance).Value = "autosomal dominant" And .Cells(iPopFreqMax).Value >= 0.01 And .Cells(iClinvar).Value = "" And .Cells(iCommon).Value = "" Then .Cells(iClassification).Value = "likely benign"
    where, as it happens with your data where you have values of 0.01 exactly, both lines are true. Normally, one of those statements would not contain the = sign in the comparison. This prevents overlap of values where both conditions end up being true.

    So you'd have either:
    ~(iPopFreqMax).Value < 0.01 And~
    ~(iPopFreqMax).Value >= 0.01 And~
    or:
    ~(iPopFreqMax).Value <= 0.01 And~
    ~(iPopFreqMax).Value > 0.01 And~

    depending on which category you want exact values of 0.01 to be placed in.
    Remember, whichever of these you choose, to make the other comparisons the same, even where you don't have paired lines.
    Last edited by p45cal; 05-10-2014 at 02:15 PM.
    p45cal
    Everyone: If I've helped and you can't be bothered to acknowledge it, I can't be bothered to look at further posts from you.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •