Thread: vba
View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
John Green[_2_] John Green[_2_] is offline
external usenet poster
 
Posts: 58
Default vba

Mike,

I was able to reproduce this behaviour when running the code from an ActiveX command button. If this is your problem, I suggest
using a Forms toolbar command button to run yor macro.

--

John Green - Excel MVP
Sydney
Australia


"Mike Cooper" wrote in message om...
Hi

I am sure there is a simple answer to this. I have the following
code:

Sub Input_Message()
With Worksheets("Master Schedule").Range("g5").Validation
.Delete
.Add Type:=xlValidateInputOnly, AlertStyle:=xlValidAlertStop,
Operator:=xlBetween
.IgnoreBlank = True
.InCellDropdown = True
.InputTitle = "dd"
.ErrorTitle = ""
.InputMessage = "It works"
.ErrorMessage = ""
.ShowInput = True
.ShowError = True
End With

End Sub

...Which works perfectly well as a macro. However, I need it as a
subroutine that is called by another subroutine. In that function the
exact same code gets the generic "Application-Defined or
Object_Defined Error" which lands on the line of code right after
.delete. If I cut that line out the error lands on the line below
that and so forth. What am I missing here??!!

Thank you,
Mike Cooper