I need a VBA event that does the following: When I enter a value in range D6:D305 of my…
- User
I need a VBA event that does the following:
When I enter a value in range D6:D305 of my Active sheet, it checks the value of D1, then it finds the match in row B31:V31 of sheet 'Sector Budget' and checks if the value exists in the corresponding column of the range B32:V42. If the match does not exist, it pops up a message "The Subsector description is not correct" and it then clears the cell entry made in my Active Sheet. If the entry matches the conditions above then it pops up the message "A negative value will decrease the budget." & vbCrLf & "" & vbCrLf & _ "A positive value will increase the budget." & vbCrLf & "" & vbCrLf & _ "Enter value in column E" and then selects Target.Offset(0, 1)
- Assistant
You can use the Worksheet_Change event in VBA to achieve this. Here's an example code that you can use:
- User
I need a VBA event that does the following:
When I enter a text value in range D6:D305 of my Active sheet, it checks the value of D1 and then it finds the first match in row B31:V31 of sheet 'Sector Budget'.
When the first match is found, it then checks down the specific column where the first match was found for the value entered in range D6:D305 of my Active sheet, this is the second match.
If the second match is not found, it pops up a message "The Subsector description is not correct" and it then clears the cell entry made in my Active Sheet.
If the second matche is found, then it pops up the message "A negative value will decrease the budget." & vbCrLf & "" & vbCrLf & _ "A positive value will increase the budget." & vbCrLf & "" & vbCrLf & _ "Enter value in column E" and then selects Target.Offset(0, 1)
- Assistant
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.