I'm new to VBA and I'm really ripping my hair out over this one. I'm working on an Excel Macro and any time I try to create a Type, I am unable to access it from within a function. I've copied and pasted similar examples from elsewhere online and get the same error (User-defined type not defined). I see that others have had similar errors, but none of the solutions seem to apply to this particular problem. Here is the (simplified) code:
Type ScheduleDate
Public Resident As String
Public SDate As Date
Public Activity As String
End Type
Sub Generate_Schedule()
Dim Sched As ScheduleDate
End Sub
Thanks in advance!
MTA: I figured this out! When I copied and pasted this here, I left out a function I had put above the Type. Apparently, VBA does not allow functions before Types. Always a risk of simplification, I suppose. Thanks for the help!
Public? msdn.microsoft.com/en-us/library/aa266315%28v=vs.60%29.aspx