PaulAsaran
New Member
- Joined
- Feb 11, 2019
- Messages
- 22
In my spreadsheet, the user has an initial option (Cell = F8) to select "Grouped" or "Separated" from a drop-down list. There is a table in the worksheet that changes depending upon which option is selected. That part was easy. What's tricky is that if F8 = "Grouped", the data column's (G18:G28) values are auto-calculated, but if F8 = "Separated" the column needs to instead allow user-entered values.
I've already found a method of checking for a change and updating appropriately:
NOTE: V10 is a user-entered value. The user is only prompted to enter it if "Grouped" is selected.
The problem with this code is that it only checks if a certain value (V10) has been changed, not what it changes to, and thus only works for one cell in the table. Instead, I need something that will work for the other cells but only if F8 changes to a specific value of "Grouped" or "Separated". Each cell will require an entirely different formula from its peers, so a ranged solution won't work, but if I can just get the basic concept working I'm sure I can apply it to each cell independently.
Peripherally related: some of the formulae will have to seek out text. For example:
My experiments show that VBA won't accept the quotes as it doesn't recognize them in the same way Excel does. How, then, do I translate formulae with text values into VBA?
I've already found a method of checking for a change and updating appropriately:
Code:
If Intersect(Target, Range("V10")) Is Nothing Then Exit Sub
Application.EnableEvents = False
ActiveSheet.Range("G23").Formula = "=V10"
Application.EnableEvents = True
End Sub
NOTE: V10 is a user-entered value. The user is only prompted to enter it if "Grouped" is selected.
The problem with this code is that it only checks if a certain value (V10) has been changed, not what it changes to, and thus only works for one cell in the table. Instead, I need something that will work for the other cells but only if F8 changes to a specific value of "Grouped" or "Separated". Each cell will require an entirely different formula from its peers, so a ranged solution won't work, but if I can just get the basic concept working I'm sure I can apply it to each cell independently.
Peripherally related: some of the formulae will have to seek out text. For example:
Code:
=SUMIF(AA13:AA27,"SB",W13:W27)
My experiments show that VBA won't accept the quotes as it doesn't recognize them in the same way Excel does. How, then, do I translate formulae with text values into VBA?