albertc30
Well-known Member
- Joined
- May 7, 2012
- Messages
- 1,091
- Office Version
- 2019
- Platform
- Windows
Hello everyone.
I have been dabbling in Google for the past 2 hours and am stuck.
This is probably so easy but I'm rubbish at this. I have seen using;
I have a fell this is what I am looking for but I just can't change it to what I'm looking for.
Any help is, as always, much appreciated.
Thanks.
I have been dabbling in Google for the past 2 hours and am stuck.
This is probably so easy but I'm rubbish at this. I have seen using;
VBA Code:
Dim answer As Integer
answer = MsgBox("You have already selected a document type to be generated! Do you wish to continue?", vbYesNo + vbQuestion, "Empty Sheet")
If answer = vbYes Then
'run required code
Else
'do nothing
End If
I have a fell this is what I am looking for but I just can't change it to what I'm looking for.
VBA Code:
Private Sub CBFindSheet_Click()
'If IsEmpty(ThisWorkbook.Sheets("Create").Range("F3").Value) = False Then 'There's a value on this cell so...
'MsgBox "You have already selected a document to be created!", vbYesNo, "Document" = vbYes 'Tell user a document type has already been selected.
'If user wants to look for a proforma, then F3 gets cleared by means of
'Range("E3").Select 'Here there's a dropdown list with Invoice and Proforma, depending on what's chosen, the cell F3 gets the next document number.
'Selection.ClearContents 'Clear the contents then run code bellow to call for proforma
'Else
'testing above
'bellow works fine
Dim sName As String
Dim sFound As Boolean
sName = InputBox(prompt:="Enter Proforma number you wish to find.", Title:="Find Proforma...")
If sName = "" Then Exit Sub
sFound = False
On Error Resume Next
ActiveWorkbook.Sheets(sName).Select
If Err = 0 Then sFound = True
On Error GoTo 0
If sFound = False Then
MsgBox prompt:="The Proforma number '" & sName & "' could not be found! This could be because it has already been issued as an invoice to the customer, or not yet issued.", Buttons:=vbExclamation, Title:="Search result"
End If
'End If
End Sub
Any help is, as always, much appreciated.
Thanks.
Last edited: