Hi,
So i'm kinda new to macros so i am recording them to have them done and to learn something.
I have recorded a macro that puts a dropdown (this one is connected to the input of a cell in adjacent column).
The macro looks like this:
So in the column AJ it is making a dropdown (the source for it is in UseCases sheet) depending on an adjacent cell in column AI.
When trying to run this macro it throws run-time error '1004': Aplication-defined or object defined error here:
Can you please advise how to correct it?
Thanks,
ursua
So i'm kinda new to macros so i am recording them to have them done and to learn something.
I have recorded a macro that puts a dropdown (this one is connected to the input of a cell in adjacent column).
The macro looks like this:
VBA Code:
Sub Macro2()
'
' Macro2 Macro
'
'
Range("AJ2").Select
Range(Selection, Selection.End(xlDown)).Select
With Selection.Validation
.Delete
.Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, Operator:= _
xlBetween, Formula1:= _
"=OFFSET(UseCases!$A$1,MATCH(AI2,UseCases!$A:$A,0)-1,1,COUNTIF(UseCases!$A:$A,AI2),1)"
.IgnoreBlank = True
.InCellDropdown = True
.InputTitle = ""
.ErrorTitle = ""
.InputMessage = ""
.ErrorMessage = ""
.ShowInput = True
.ShowError = True
End With
End Sub
So in the column AJ it is making a dropdown (the source for it is in UseCases sheet) depending on an adjacent cell in column AI.
When trying to run this macro it throws run-time error '1004': Aplication-defined or object defined error here:
VBA Code:
.Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, Operator:= _
xlBetween, Formula1:= _
"=OFFSET(UseCases!$A$1,MATCH(AI2,UseCases!$A:$A,0)-1,1,COUNTIF(UseCases!$A:$A,AI2),1)"
Can you please advise how to correct it?
Thanks,
ursua