Visual Basic Button Will Not Work Runs Fine in Developer Mode RRS feed

  • Question

  • I had a Visual Basic that was functioning fine.  Now the button will not work.  If I go into Developer Mode and run the VB, it runs as expected.  VB is below, but, I'm not sure if this is the problem as it runs fine in Developer.

    Is there maybe a setting that got change?  We had an MS Update auto-installed last night.


    Private Sub CommandButton1_Click()
    Dim strLastRow As String
    Dim rngC As Range
    Dim strToFind As String, FirstAddress As String
    Dim wSht As Worksheet
    Dim rngtest As String
    Application.ScreenUpdating = False
    Set wSht = Worksheets("Density")
    strToFind = InputBox("Enter Search Criteria")
    With wSht.Range("A:A")
    Set rngC = .Find(what:=strToFind, LookAt:=xlPart)
    If Not rngC Is Nothing Then
    FirstAddress = rngC.Address
    strLastRow = Sheets("Sheet1").Range("A" & Rows.Count).End(xlUp).Row - 9
    rngC.EntireRow.Copy Sheets("Sheet1").Cells(strLastRow, 1)
    Set rngC = .FindNext(rngC)
    Loop While Not rngC Is Nothing And rngC.Address <> FirstAddress
    End If
    End With
    MsgBox ("Click OK for Result")

    End Sub

    Friday, January 9, 2015 5:57 PM