Results 1 to 7 of 7

Find Next Function with two criteria Help

Threaded View

  1. #1
    Registered User
    Join Date
    11-13-2015
    Location
    USA
    MS-Off Ver
    2010
    Posts
    3

    Find Next Function with two criteria Help

    Hello All,


    First of all sorry if this is answered somewhere already, but I didn't know exactly how to word it.

    I am an Engineering Intern that has somehow been tasked with writing Excel Macro for the last month. I've taught myself quite a lot so far but cant figure this one out.

    The first part of the macro needs to search Column Z for the next cell that is not blank or contain a value of 12 in it and then select it. (I.E. a cell contain a value of 8 or 4.2)

    The next part of the macro needs run a goal seek function changing column X until Column Z is 12

    Then End itself when all of Column Z is either blank or 12


    I have written This code so far and it works perfectly except it checks every single row. Which is super slow since there are currently 75500 rows at the moment and will only increase over the years.
    Sub GoalSeek()
    
    Dim i As Long
       For i = 5 To 75500
          If (Range("Z" & i) = 12 Or Range("Z" & i) = "") Then
                       Else
                       With Range("Z" & i)
                        .GoalSeek Goal:=12, ChangingCell:=Range("X" & i)
                        End With
               
               End If
        Next i
    End Sub
    My theory for writing it like this was to hopefully speed up the checking process before goal seek was used. but it is still very slow. ( I know the goal seek part will have to be slow no matter what)

    This code runs when the file is saved and that will only happen if someone updates a value which will change minimum 27 rows and maximum 2145 rows, So the bulk of the 75500 rows will not need to be looked at before saving. (Which I can't seem to avoid)

    Any help or lessons would be greatly appreciated, I'm a quick study most of the time, but I can't find any info on this one to study unfortunately.
    Last edited by wlyon; 11-13-2015 at 05:55 PM.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Find array based on specific criteria to use in SUMPRODUCT function
    By cfrae84 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 07-10-2015, 09:08 AM
  2. Replies: 3
    Last Post: 02-02-2015, 10:30 AM
  3. [SOLVED] Find a number closest to 30 in a range with one more criteria (criteria includes text)
    By Sarangsood in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 07-22-2013, 01:16 PM
  4. Replies: 4
    Last Post: 09-18-2012, 10:54 AM
  5. Replies: 6
    Last Post: 07-09-2012, 11:06 AM
  6. function to find out count based on criteria.
    By arnab0711 in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 05-30-2011, 06:45 AM
  7. Find function with additional search criteria
    By Neil07979 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 07-02-2009, 10:38 AM

Tags for this Thread

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