If Value X is selected Rows 1 / 2 will be hidden (+DYNAMIC with previous code)

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]:


  1. When they select A, the rows 9 & 10 should disappear
  2. When they select B, the rows 9 & 10 should (re)appear
Second Dropdown [E11]:


  1. When they select C, the rows 15 - 19 should disappear
  2. 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!
 
Re: If Value X is selected Rows 1 / 2 will be hidden (+DYNAMIC with previous code) [NOT EASY]

Legend! Thank you so much!
 
Upvote 0

Excel Facts

Back into an answer in Excel
Use Data, What-If Analysis, Goal Seek to find the correct input cell value to reach a desired result
Re: If Value X is selected Rows 1 / 2 will be hidden (+DYNAMIC with previous code) [NOT EASY]

I'm glad to help you. Thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,223,958
Messages
6,175,632
Members
452,661
Latest member
Nonhle

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top