For...Next with drop down lists

wwbwb

Well-known Member
Joined
Oct 20, 2003
Messages
513
Greetings:

In a production reporting spreadsheet, users fill in their daily activities via drop downs.
b5:b25 contains drop downs listing areas worked.
c5:c25 contains drop downs listing activities.

One of the areas in the drop down is Leave_Snack.
There are 5 activities associated with this area.

What they are supposed to do is when they select Leave_Snack, is to also include the activity. (Snack/Cleanup, Leave Other, Leave Family...etc)
Sometimes they forget.

When the form is submited (basically copied and saved to a different sheet), I want a warning to pop up saying that they forgot to put an activity with their Leave_Snack.

I put this at the beginning of the submit code, but it doesn't seem to recognize anything from a dropdown list. Am I missing something?

Code:
Dim mycell As Range
Dim myrange As Range

Set myrange = Range("b5:b25")

For Each mycell In myrange
 If Range(mycell).Value = "Leave_Snack" Then
  If Range(mycell).Offset(, 1).Value = "" Then GoTo error2
 End If
Next
 

Excel Facts

What is the last column in Excel?
Excel columns run from A to Z, AA to AZ, AAA to XFD. The last column is XFD.
Maybe...

Code:
Dim mycell As Range
Dim myrange As Range
Set myrange = Range("b5:b25")
For Each mycell In myrange
    If mycell.Value = "Leave_Snack" Then
        If mycell.Offset(, 1).Value = "" Then GoTo error2
    End If
Next
'more code

M.
 
Upvote 0

Forum statistics

Threads
1,213,484
Messages
6,113,927
Members
448,533
Latest member
thietbibeboiwasaco

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