In the worksheet “PB” range (“C14:C313”) contains drop down list “Account”.
In the worksheet “CA” range (“B3:B1000”) is dynamic List named as “Account”
In the same sheet “CA” range (“D3:D1000”) represents account rules assigned to each account
In total there are 8 rules as listed below:
“Rule 1”
“Rule 2”
“Rule 3”
“Rule 4”
“Rule 5”
“Rule 6”
“Rule 7”
“Rule 8”
“Rule 1” and “Rule 2” requires no list
“Rule 2” and “Rule 4” requires dynamic “LR” list from the worksheet “RC”
“Rule 5” requires dynamic “LA” list from the worksheet “AC”
“Rule 6” requires dynamic “LC” list from the worksheet “CC”
“Rule 7” requires dynamic “LT” list from the worksheet “TC”
“Rule 8” requires dynamic “LP” list from the worksheet “PC”
Question is how to make drop down list available in column “E” in "PB" sheet referring to the rule of for selected account in column “C”?
Example:
If in cell C14 account code is 1100 and respective account rule is “Rule 2” then in cell E14 available list should be “LR”
If in cell C15 account code is 1200 and respective account rule is “Rule 1” then in cell E15 should not contain a list. (Preferably the cell should be locked)
If in cell C16 account code is 3800 and respective account rule is “Rule 5” then in cell E16 available list should be “LA”
If in cell C17 account code is 5500 and respective account rule is “Rule 8” then in cell E16 available list should be “LP”
Etc
I tried to enter the following formula in data validation in column “E” but it failed
Here is formula
=IF(OR(VLOOKUP(Table3[@Account],Table2,3,FALSE)="Rule 2",VLOOKUP(Table3[@Account],Table2,3,FALSE)="Rule 4"),LR,IF(VLOOKUP(Table3[@Account],Table2,3,FALSE)="Rule 5",LA,IF(VLOOKUP(Table3[@Account],Table2,3,FALSE)="Rule 6",LC,IF(VLOOKUP(Table3[@Account],Table2,3,FALSE)="Rule 7",LT,IF(VLOOKUP(Table3[@Account],Table2,3,FALSE)="Rule 8",LP,"")))))
I also tried to write VBA but being completely new .. hmmmm got no result
Here it is
Sub LookupLRMain()
If Formula = "=IF(OR(VLOOKUP(Table3[@Account],Table2,3,FALSE)=""Rule 2"",VLOOKUP(Table3[@Account],Table2,3,FALSE)=""Rule 4""),LR,IF(VLOOKUP(Table3[@Account],Table2,3,FALSE)=""Rule 5"",LA,IF(VLOOKUP(Table3[@Account],Table2,3,FALSE)=""Rule 6"",LC,IF(VLOOKUP(Table3[@Account],Table2,3,FALSE)=""Rule 7"",LT,IF(VLOOKUP(Table3[@Account],Table2,3,FALSE)=""Rule 8"",LP,"""")))))" = True Then
With Selection.Validation
.Delete
.Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, Operator:= _
xlBetween, Formula:= _
"=IF(OR(VLOOKUP(Table3[@Account],Table2,3,FALSE)=""Rule 2"",VLOOKUP(Table3[@Account],Table2,3,FALSE)=""Rule 4""),LR,IF(VLOOKUP(Table3[@Account],Table2,3,FALSE)=""Rule 5"",LA,IF(VLOOKUP(Table3[@Account],Table2,3,FALSE)=""Rule 6"",LC,IF(VLOOKUP(Table3[@Account],Table2,3,FALSE)=""Rule 7"",LT,IF(VLOOKUP(Table3[@Account],Table2,3,FALSE)=""Rule 8"",LP,""""))))) "
.IgnoreBlank = True
.InCellDropdown = True
.InputTitle = ""
.ErrorTitle = ""
.InputMessage = ""
.ErrorMessage = ""
.ShowInput = True
.ShowError = True
End With
Else
Sheets("PB").Select
Range("B14").Select
End If
End Sub
It look this task for me is a Rubicon and any help to solve this problem I is highly appreciated.
BIG, BIG Thanks in advance
GioP
In the worksheet “CA” range (“B3:B1000”) is dynamic List named as “Account”
In the same sheet “CA” range (“D3:D1000”) represents account rules assigned to each account
In total there are 8 rules as listed below:
“Rule 1”
“Rule 2”
“Rule 3”
“Rule 4”
“Rule 5”
“Rule 6”
“Rule 7”
“Rule 8”
“Rule 1” and “Rule 2” requires no list
“Rule 2” and “Rule 4” requires dynamic “LR” list from the worksheet “RC”
“Rule 5” requires dynamic “LA” list from the worksheet “AC”
“Rule 6” requires dynamic “LC” list from the worksheet “CC”
“Rule 7” requires dynamic “LT” list from the worksheet “TC”
“Rule 8” requires dynamic “LP” list from the worksheet “PC”
Question is how to make drop down list available in column “E” in "PB" sheet referring to the rule of for selected account in column “C”?
Example:
If in cell C14 account code is 1100 and respective account rule is “Rule 2” then in cell E14 available list should be “LR”
If in cell C15 account code is 1200 and respective account rule is “Rule 1” then in cell E15 should not contain a list. (Preferably the cell should be locked)
If in cell C16 account code is 3800 and respective account rule is “Rule 5” then in cell E16 available list should be “LA”
If in cell C17 account code is 5500 and respective account rule is “Rule 8” then in cell E16 available list should be “LP”
Etc
I tried to enter the following formula in data validation in column “E” but it failed
Here is formula
=IF(OR(VLOOKUP(Table3[@Account],Table2,3,FALSE)="Rule 2",VLOOKUP(Table3[@Account],Table2,3,FALSE)="Rule 4"),LR,IF(VLOOKUP(Table3[@Account],Table2,3,FALSE)="Rule 5",LA,IF(VLOOKUP(Table3[@Account],Table2,3,FALSE)="Rule 6",LC,IF(VLOOKUP(Table3[@Account],Table2,3,FALSE)="Rule 7",LT,IF(VLOOKUP(Table3[@Account],Table2,3,FALSE)="Rule 8",LP,"")))))
I also tried to write VBA but being completely new .. hmmmm got no result
Here it is
Sub LookupLRMain()
If Formula = "=IF(OR(VLOOKUP(Table3[@Account],Table2,3,FALSE)=""Rule 2"",VLOOKUP(Table3[@Account],Table2,3,FALSE)=""Rule 4""),LR,IF(VLOOKUP(Table3[@Account],Table2,3,FALSE)=""Rule 5"",LA,IF(VLOOKUP(Table3[@Account],Table2,3,FALSE)=""Rule 6"",LC,IF(VLOOKUP(Table3[@Account],Table2,3,FALSE)=""Rule 7"",LT,IF(VLOOKUP(Table3[@Account],Table2,3,FALSE)=""Rule 8"",LP,"""")))))" = True Then
With Selection.Validation
.Delete
.Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, Operator:= _
xlBetween, Formula:= _
"=IF(OR(VLOOKUP(Table3[@Account],Table2,3,FALSE)=""Rule 2"",VLOOKUP(Table3[@Account],Table2,3,FALSE)=""Rule 4""),LR,IF(VLOOKUP(Table3[@Account],Table2,3,FALSE)=""Rule 5"",LA,IF(VLOOKUP(Table3[@Account],Table2,3,FALSE)=""Rule 6"",LC,IF(VLOOKUP(Table3[@Account],Table2,3,FALSE)=""Rule 7"",LT,IF(VLOOKUP(Table3[@Account],Table2,3,FALSE)=""Rule 8"",LP,""""))))) "
.IgnoreBlank = True
.InCellDropdown = True
.InputTitle = ""
.ErrorTitle = ""
.InputMessage = ""
.ErrorMessage = ""
.ShowInput = True
.ShowError = True
End With
Else
Sheets("PB").Select
Range("B14").Select
End If
End Sub
It look this task for me is a Rubicon and any help to solve this problem I is highly appreciated.
BIG, BIG Thanks in advance
GioP