RavosJ
New Member
- Joined
- Aug 27, 2019
- Messages
- 8
Hi All,
I am almost in the final stages of my code and I am very excited! So close to the end, I can smell it.
Unfortunately this also means he code is getting trickier.
What I want to accomplish:
I have 2 important dropdowns with each 2 different options: 1. A / B - 2. C / D
First Dropdown [E8]:
This might seem not that hard, however, I need it to be dynamic and fit in my current coding:
Sub Mod_SendWorkbook()
Dim OutlookMail AsObject
Set OutlookMail =CreateObject("Outlook.Application").CreateItem(0)
'******validatefields******'
IfRange("D7").Value = "" Then
MsgBox"Please Select Value on row 7"
Exit Sub
End If
IfRange("E8").Value = "" Then
MsgBox"Please Select Value on row 8"
Exit Sub
End If
IfRange("E11").Value = "" Then
MsgBox"Please Select Value on row 11"
Exit Sub
End If
IfRange("D12").Value = "" Then
MsgBox"Please Select Value on row 12"
Exit Sub
End If
IfRange("D14").Value = "" Then
MsgBox"Please select value on row 14"
Exit Sub
End If
IfRange("D15").Value = "" Then
MsgBox"Please Select Value on row 15"
Exit Sub
End If
IfRange("D17").Value = "" Then
MsgBox"Please Select Value on row 17"
Exit Sub
End If
IfRange("D18").Value = "" Then
MsgBox"Please Select Value on row 18"
Exit Sub
End If
If Range("D19").Value = "" Then
MsgBox"Please Select Value on row 19"
Exit Sub
'******validatefields******'
On Error Resume Next
With OutlookMail
.To = "xxxxx@gmail.com"
.CC = ""
.BCC =""
.Subject =Range("D7").Text
.Body ="Please check attached file, thank you."
.Attachments.AddApplication.ActiveWorkbook.FullName
.Send
If Err.Number = 0Then
MsgBox"sent successfully"
Else
MsgBox"Sent error: " & Err.Number & " Description: "& Err.Description
End If
End With
Set OutlookMail =Nothing
End Sub
Any thoughts, help or direction would be highly appreciated!
I am almost in the final stages of my code and I am very excited! So close to the end, I can smell it.
Unfortunately this also means he code is getting trickier.
What I want to accomplish:
I have 2 important dropdowns with each 2 different options: 1. A / B - 2. C / D
First Dropdown [E8]:
- When they select A, the rows 9 & 10 should disappear
- When they select B, the rows 9 & 10 should (re)appear
- When they select C, the rows 15 - 19 should disappear
- When theyselect D, the rows 15 - 19 should (re)appear
This might seem not that hard, however, I need it to be dynamic and fit in my current coding:
Sub Mod_SendWorkbook()
Dim OutlookMail AsObject
Set OutlookMail =CreateObject("Outlook.Application").CreateItem(0)
'******validatefields******'
IfRange("D7").Value = "" Then
MsgBox"Please Select Value on row 7"
Exit Sub
End If
IfRange("E8").Value = "" Then
MsgBox"Please Select Value on row 8"
Exit Sub
End If
IfRange("E11").Value = "" Then
MsgBox"Please Select Value on row 11"
Exit Sub
End If
IfRange("D12").Value = "" Then
MsgBox"Please Select Value on row 12"
Exit Sub
End If
IfRange("D14").Value = "" Then
MsgBox"Please select value on row 14"
Exit Sub
End If
IfRange("D15").Value = "" Then
MsgBox"Please Select Value on row 15"
Exit Sub
End If
IfRange("D17").Value = "" Then
MsgBox"Please Select Value on row 17"
Exit Sub
End If
IfRange("D18").Value = "" Then
MsgBox"Please Select Value on row 18"
Exit Sub
End If
If Range("D19").Value = "" Then
MsgBox"Please Select Value on row 19"
Exit Sub
'******validatefields******'
On Error Resume Next
With OutlookMail
.To = "xxxxx@gmail.com"
.CC = ""
.BCC =""
.Subject =Range("D7").Text
.Body ="Please check attached file, thank you."
.Attachments.AddApplication.ActiveWorkbook.FullName
.Send
If Err.Number = 0Then
MsgBox"sent successfully"
Else
MsgBox"Sent error: " & Err.Number & " Description: "& Err.Description
End If
End With
Set OutlookMail =Nothing
End Sub
Any thoughts, help or direction would be highly appreciated!