Hello. I have an issue where Excel 2007 is crashing while running the following code. Here is what I ultimately want to achieve:
In cell C18, I have a drop-down list with 4 values (5 if you include the default blank). Once the user selects from that list, I want VB code to analyze each cell in range H4:H33. If any of those cells are blank, then make the cell next to it blank else make it "no".
Simply put, any time a user changes the value in C18, it should run the code once to make a select group of cells either "no" or blank.
Option Explicit
Sub Worksheet_Change(ByVal Target As Range)
Application.ScreenUpdating = False
Dim rngCellWithEventName As Range
Set rngCellWithEventName = ActiveSheet.Range("C18")
If ActiveCell = ActiveSheet.Range("C18") Then
Select Case rngCellWithEventName
Case "Athlete"
AthleteStuffToDo
Case "Culture":
Case "Event":
Case "SBM":
Case Else: Exit Sub
End Select
End If
Application.ScreenUpdating = True
End Sub
Function AthleteStuffToDo()
Dim rngCellBeingChecked As Range
For Each rngCellBeingChecked In Range("H4:H33")
If rngCellBeingChecked.Value = "" Then
rngCellBeingChecked.Offset(0, 1).Value = ""
Else
rngCellBeingChecked.Offset(0, 1).Value = "no"
End If
Next rngCellBeingChecked
End Function
Bookmarks