Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. VBA: Searching for a range in a worksheet.

VBA: Searching for a range in a worksheet.

Scheduled Pinned Locked Moved Visual Basic
algorithmsdata-structuresquestion
7 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Offline
    C Offline
    cyrossis
    wrote on last edited by
    #1

    Hi, Is there a VBA technique to search for existence of a range of cells containing certain values and if such range(s) exists severally in a worksheet return an array of these ranges or at least their coordinates? Regards, Cyril

    S D 2 Replies Last reply
    0
    • C cyrossis

      Hi, Is there a VBA technique to search for existence of a range of cells containing certain values and if such range(s) exists severally in a worksheet return an array of these ranges or at least their coordinates? Regards, Cyril

      S Offline
      S Offline
      Simon_Whale
      wrote on last edited by
      #2

      Excel Ranges - Stackoverflow[^]

      As barmey as a sack of badgers Dude, if I knew what I was doing in life, I'd be rich, retired, dating a supermodel and laughing at the rest of you from the sidelines.

      1 Reply Last reply
      0
      • C cyrossis

        Hi, Is there a VBA technique to search for existence of a range of cells containing certain values and if such range(s) exists severally in a worksheet return an array of these ranges or at least their coordinates? Regards, Cyril

        D Offline
        D Offline
        Dr Walt Fair PE
        wrote on last edited by
        #3

        I'm not clear on what you want to search and for what, so perhaps you could clarify. Do you want to search - a range of cells for a value that fits in one cell and return all the cells containing the value? - a range of cells for a value that may occur across cells? - a spreadsheet for a specific sequence of cell vales?

        CQ de W5ALT

        Walt Fair, Jr., P. E. Comport Computing Specializing in Technical Engineering Software

        L C 2 Replies Last reply
        0
        • D Dr Walt Fair PE

          I'm not clear on what you want to search and for what, so perhaps you could clarify. Do you want to search - a range of cells for a value that fits in one cell and return all the cells containing the value? - a range of cells for a value that may occur across cells? - a spreadsheet for a specific sequence of cell vales?

          CQ de W5ALT

          Walt Fair, Jr., P. E. Comport Computing Specializing in Technical Engineering Software

          L Offline
          L Offline
          Luc Pattyn
          wrote on last edited by
          #4

          Or maybe a rectangular range of cells, sized A by B, containing each and every value of another rectangular range of cells, sized C by D, where A*B equals C*D and the order of the matching cells doesn't matter. :-D

          Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum

          Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.

          D C 2 Replies Last reply
          0
          • L Luc Pattyn

            Or maybe a rectangular range of cells, sized A by B, containing each and every value of another rectangular range of cells, sized C by D, where A*B equals C*D and the order of the matching cells doesn't matter. :-D

            Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum

            Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.

            D Offline
            D Offline
            Dr Walt Fair PE
            wrote on last edited by
            #5

            ... contains the equivalent words, if translated to Dutch?

            CQ de W5ALT

            Walt Fair, Jr., P. E. Comport Computing Specializing in Technical Engineering Software

            1 Reply Last reply
            0
            • D Dr Walt Fair PE

              I'm not clear on what you want to search and for what, so perhaps you could clarify. Do you want to search - a range of cells for a value that fits in one cell and return all the cells containing the value? - a range of cells for a value that may occur across cells? - a spreadsheet for a specific sequence of cell vales?

              CQ de W5ALT

              Walt Fair, Jr., P. E. Comport Computing Specializing in Technical Engineering Software

              C Offline
              C Offline
              cyrossis
              wrote on last edited by
              #6

              Hi Walt, I think the 3rd is more of what I require. I am formatting reports of a system that dumps in ASCII format, and it places several reports sequentially on one text file. I figured to isolate these reports the best option is to upload into excel and search for the cells that contain the header fields and thus know where each report begins as the report offers no other fields/tags that indicate report start and end. Thus I want to iterate and find all ranges where cell 1 in the range contains value 1, cell 2 contains value 2, cell 3 contains value 3 etc thus indicating where each report begins. A bit messy but seems to be the only way out Regards

              modified on Wednesday, January 12, 2011 1:32 AM

              1 Reply Last reply
              0
              • L Luc Pattyn

                Or maybe a rectangular range of cells, sized A by B, containing each and every value of another rectangular range of cells, sized C by D, where A*B equals C*D and the order of the matching cells doesn't matter. :-D

                Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum

                Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.

                C Offline
                C Offline
                cyrossis
                wrote on last edited by
                #7

                Hi Luc, What you describe is what I am looking to do, but the order of the matching cells matters. Cell A1 of the range has to be C1 etc... :)

                1 Reply Last reply
                0
                Reply
                • Reply as topic
                Log in to reply
                • Oldest to Newest
                • Newest to Oldest
                • Most Votes


                • Login

                • Don't have an account? Register

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • World
                • Users
                • Groups