Solved VBA coding issue If .... Then

February 20, 2014 at 09:59:01
Specs: Windows 7
Hi Guys,
Have an issue with the following bit of code

    If MsgBox("DO YOU WISH TO CHANGE/AMEND YOUR SETTINGS?.", vbYesNo) = vbYes Then
        If Range("STATS!SH57") < 1 Then
            If MsgBox("NO DATA HAS BEEN ENTERED FOR THE PERIOD, ARE YOU SURE YOU REQUIRE TO MAKE CHANGES?", vbYesNo) = vbYes Then
    
        Sheets("HCPAR").Visible = True
        Sheets("HCPAR").Select

    Sheets("HCPAR").Range("B4:B6, C5:C6, F4:F6, A9:C17, A19, A22").Select
    Selection.Locked = False
    Selection.FormulaHidden = True
    Sheets("HCPAR").Range("A1").Select
   
    Else
    
    If Range("STATS!SH57") > 1 Then

This is only part of the full coding I am trying to use. The problem seems to be this line of code

If Range("STATS!SH57") < 1 Then

If I debug using F8, I get to this line and then end up at the last 'End If'
For some reason this line of code is not working. Just to confirm with you, Range("STATS!SH57") contains a COUNTIF formula to ascertain a value. I have also replaced this with a value of 1, and the problem persists.
Any ideas what I am doing wrong?


See More: VBA coding issue If .... Then

Report •

#1
February 20, 2014 at 11:05:52
✔ Best Answer
Hi there,
sorry if any one is working on this for me. I have resolved it. The problem being that the End If instructions being in the wrong position in the coding.
Again sorry to waste any ones time

Report •
Related Solutions


Ask Question