Hi,
I would like to be able to automate the responses to message boxes and imput boxes in some of my subroutines, depending on the input from other subroutines. Is it possible to do this?
A fragment of one such subroutine I would like to automate occasionally is below:
Sub ChangeDim()
' Change one of the dimensions to be measured
Dim Show_Box As Boolean
Dim Wks As Worksheet
Dim DimRep As Variant
Sheet1.Protect UserInterfaceOnly:=True
ans = MsgBox("Are you sure you want to proceed?", vbOKCancel + vbExclamation)
If ans = vbCancel Then Exit Sub
' Name and verify the dimension abbreviation to be replaced
Show_Box = True
While Show_Box = True
DimRep = InputBox("Enter the abbreviation of the dimension you wish to change", "Replaced dimension")
' Test abbreviation to find out if it is unique
For Each Wks In Worksheets
If StrComp(Wks.Name, DimRep, 1) = 0 Then
Show_Box = False
Exit For
End If
Next Wks
If Show_Box = True Then MsgBox "Abbreviation not found!"
Wend
Sheet1.Cells(6 + Sheets(DimRep).Index, 5) = DimRep
end Sub