I'm having trouble with functions and how to either get them to work together or cancel all together...I'll show you what I mean.
Here's an example of code I have written that works fairly well within itself: [VBA]Public Function Deal_IDs()
On Error Resume Next
Worksheets("Sheet1").Activate
Dim DealIDs As Range
Set DealIDs = Application.InputBox("With your mouse, highlight the column for the Deal IDs / Sequence #s:", "Deal IDs", _
"F:F", Type:=8)
If DealIDs = vbCancel Then
Exit Function
Else
If DealIDs Is Nothing Then
Answer = MsgBox("A valid selection hasn't been made for the Deal IDs / Sequence #s. Try again?", vbOKCancel + vbQuestion)
If Answer = vbCancel Then 'No retry
Exit Function
Else 'retry
Run "Deal_IDs"
End If
End If
End If
End Function
Public Function Request_End_Date()
On Error Resume Next
Worksheets("Sheet1").Activate
Dim RequestEndDate As Range
Set RequestEndDate = Application.InputBox("Highlight the column for the Requested Expiration Date:", _
"Requested Expiration Date of Current Deal", "A:A", Type:=8)
If RequestEndDate = vbCancel Then
Exit Function
End If
If RequestEndDate Is Nothing Then
RequestEndDate = MsgBox("A valid selection hasn't been made for the Requested Expiration Date. Try again?", vbOKCancel + vbQuestion)
If Answer = vbCancel Then 'No retry
Exit Function
Else 'retry
Run "Request_End_Date"
End If
End If
End Function[/VBA]
I'm having 2 problems:
1) If the user selection is invalid, I'm not getting the msgbox I'm wanting...excel is popping it's standard pop (which nonetheless gets the job done but I want my error message to appear).
2) How do I call the 2nd function within the 1st function? If the user selects cancel at any time, I want the entire macro to stop but if the user does the right selections, I want it to continue until there's nothing left.
Any help would be appreciated..I've been sitting here for hours trying to figure it out to no avail.