ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   vba (https://www.excelbanter.com/excel-programming/271457-re-vba.html)

John Green[_2_]

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





All times are GMT +1. The time now is 11:57 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com