Consulting

Results 1 to 2 of 2

Thread: application defined error - VBA

  1. #1

    application defined error - VBA

    Hi,

    I have an excel sheet that is loaded with a dynamic result set of data. Column C2 depends on A2 Column data. The following code throws an 'Applicaton-defined or object-defined error':

    [vba]
    Sheet1.Activate
    With ActiveWorkbook.ActiveSheet.Range("C2").Validation
    .Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, Operator:= _
    xlBetween, Formula1:= _
    "=OFFSET(regionstart, MATCH(A2, BookElement,0)-1,1,COUNTIF(BookElement,A2),1)"
    .IgnoreBlank = True
    .InCellDropdown = True
    .InputTitle = ""
    .ErrorTitle = "Error"
    .InputMessage = ""
    .ErrorMessage = "You can only choose from the list."
    .ShowInput = True
    .ShowError = True
    End With
    Range("C2").Select
    Selection.AutoFill Destination:=Range("C2:C1000"), Type:=xlFillDefault
    [/vba]

    bye
    Murugavel

    Last edited by Bob Phillips; 11-23-2009 at 03:34 AM. Reason: Add VBA tags

  2. #2
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    Where?
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •