+ Reply to Thread
Results 1 to 2 of 2

Macro created defined list not recognized by macro to populate list

  1. #1
    Registered User
    Join Date
    04-20-2012
    Location
    London, England
    MS-Off Ver
    Excel 2007
    Posts
    8

    Question Macro created defined list not recognized by macro to populate list

    Hi, Hopefully someone can help me;

    I wrote this macro to create a new list

    'Add famer group to ranges
    Range("E8").Select
    Selection.Copy
    Sheets("Farmers").Select
    ActiveSheet.Range("i1").End(xlToRight).Offset(0, 1).PasteSpecial xlPasteValues
    ActiveSheet.Range("i1").End(xlToRight).Select
    Selection.Resize(Selection.Rows.Count + 20, Selection.Columns.Count).Select
    Selection.CreateNames Top:=True, Left:=False, Bottom:=False, Right:= _
    False

    which works and creates a named range.
    However when I try to add a name to this list using the following, it gives me the error "Runtime Error '91' Object variable or with block variable not set"

    'add farmer name to Farmer Group list
    Set CommonFIND = wsFARM.Rows(1).Find(wsADD.Range("e15"), LookIn:=xlValues, LookAt:=xlWhole)
    CommonFIND.End(xlDown).Offset(1).Value = wsADD.Range("F15").Value


    Any help gratefully received

    thanks

  2. #2
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: Macro created defined list not recognized by macro to populate list

    Your Find is failing therefore you get an error when you try to use the found cell-you ought to check it's not Nothing before you try to use it
    Josie

    if at first you don't succeed try doing it the way your wife told you to

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1