+ Reply to Thread
Results 1 to 8 of 8

Runtime error 1004 when searching for either of two values

  1. #1
    Valued Forum Contributor
    Join Date
    01-16-2012
    Location
    England
    MS-Off Ver
    MS 365
    Posts
    1,394

    Runtime error 1004 when searching for either of two values

    Can't see what is generating the 1004 error.

    Database has values in Row 1, Store Names in Col B and Stock totals in Cols C - J

    Macro below should find the Col corresponding to C2 in Extract, then copy and paste the Store Names and stock values where they are neither Zero or "n/a", but that generates the Error.

    Please Login or Register  to view this content.
    All solutions, suggestions and alternatives welcome as ever

    Ochimus

  2. #2
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,078

    Re: Runtime error 1004 when searching for either of two values

    On this line
    Please Login or Register  to view this content.
    you need to change Range to Cells.
    Range needs a string for the column not a number

  3. #3
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,176

    Re: Runtime error 1004 when searching for either of two values

    Need to change Range to .cells
    Good Luck
    I don't presume to know what I am doing, however, just like you, I too started somewhere...
    One-day, One-problem at a time!!!
    If you feel I have helped, please click on the star to left of post [Add Reputation]
    Also....add a comment if you like!!!!
    And remember...Mark Thread as Solved.
    Excel Forum Rocks!!!

  4. #4
    Forum Expert José Augusto's Avatar
    Join Date
    10-29-2014
    Location
    Portugal
    MS-Off Ver
    2013-2016
    Posts
    3,329

    Re: Runtime error 1004 when searching for either of two values

    Hi

    I suppose that must be this
    Please Login or Register  to view this content.
    instead this
    Please Login or Register  to view this content.

  5. #5
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,176

    Re: Runtime error 1004 when searching for either of two values

    Another Option...
    Please Login or Register  to view this content.
    Or your code corrected...

    Please Login or Register  to view this content.
    Last edited by sintek; 05-27-2019 at 02:17 PM.

  6. #6
    Valued Forum Contributor
    Join Date
    01-16-2012
    Location
    England
    MS-Off Ver
    MS 365
    Posts
    1,394

    Re: Runtime error 1004 when searching for either of two values

    Many thanks to everyone for prompt responses and identifying my mistake that generated the error!

    Can now mark this as Solved.

    Ochimus

  7. #7
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,176

    Re: Runtime error 1004 when searching for either of two values

    Pleasure ... Thanks for rep +

  8. #8
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,078

    Re: Runtime error 1004 when searching for either of two values

    You're welcome & thanks for the feedback

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. VBA error: runtime error 1004 : Method range of object - 'Global' failed.
    By Afjio12 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-28-2019, 04:37 AM
  2. Runtime error '1004': Paste special method of range class error.
    By Daryl Zer0 in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 11-05-2014, 01:44 AM
  3. [SOLVED] VBA Error: Runtime Error 1004: AutoFilter method of Range class failed
    By jl22stac in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-03-2013, 07:27 PM
  4. Runtime Error 1004 when concatenating numeric values into string
    By spokok in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-20-2013, 04:33 PM
  5. [SOLVED] Range error in code, runs alone but not inside my full program, giving runtime error 1004
    By charizzardd in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-23-2012, 03:34 PM
  6. Runtime Error 1004 when Setting Setting Series Values
    By tonymctigue in forum Excel Charting & Pivots
    Replies: 2
    Last Post: 04-09-2010, 10:05 AM
  7. [SOLVED] Excel 2003 Macro Error - Runtime error 1004
    By Cow in forum Excel General
    Replies: 2
    Last Post: 06-07-2005, 09:05 AM

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