Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6071377
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T10:02:24+00:00 2026-05-23T10:02:24+00:00

I am creating a search function that loops through a 1 dimensional array looking

  • 0

I am creating a search function that loops through a 1 dimensional array looking for answers specified by the user and my problem currently is that I only want the search to loop through the searched range once. However, it is currently stuck in the loop. Is there any suggestions on how I can exit this loop after it searches through the function once? I have currently the following code below. I am storing the cell addresses in the Results1() array and I only want each found term to be stored once

P1B1 is a radio button that specifies the function to search through the data range for any values less than the specified (Textbox1) value. FindRange1 is the range of data values I want the function to search through.

Dim Results1() As Variant
Dim Find1 As Range
Dim FindRange1 As Range
Dim TextBox1 As Long
Dim i1 As Long

            Set FindRange1 = Worksheets("Properties").Range("P7:P1000")
            If ILsearch.P1B1.Value = True Then
                For i1 = 0 To Max
                    For Each Find1 In FindRange1
                        If (Find1.Value < TextBox1) And (Find1.Value > 0) Then
                            i1 = i1 + 1
                            ReDim Preserve Results1(i1)
                            Results1(i1) = Find1.Address
                        End If
                    Next Find1
                Next i1
            End If
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T10:02:25+00:00Added an answer on May 23, 2026 at 10:02 am

    Just get rid for the For i1=0 to Max loop – judging by your requirements it is not needed, as you only seem to want to visit every element in FindRange1 once.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am currently busy creating a search function that queries a user input string
I'm currently creating a search function in lua which basically just goes through a
I'm creating a Java application where the user can search through a list of
I'm creating a search function for my website where the user can put in
I'm doing this system Stacked and I am creating the search function. And in
I'm creating eBay style search panes that allow users to narrow their results set
I'm creating a set of search panes that allow users to tweak their results
id like to have an input box that a user can enter a search
I have an Ajax request that returns search results, and I am dynamically creating
I am creating a small search function on my site, this enables the search

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.