+ Reply to Thread
Results 1 to 5 of 5

Excel vba - Loop thru a dynamic range, Find value does not go beyond second found value.

Hybrid View

Trompie Excel vba - Loop thru a... 04-02-2014, 07:12 PM
6StringJazzer Re: Excel vba - Loop thru a... 04-02-2014, 09:39 PM
Trompie Re: Excel vba - Loop thru a... 04-02-2014, 10:16 PM
AlphaFrog Re: Excel vba - Loop thru a... 04-02-2014, 10:41 PM
Trompie Re: Excel vba - Loop thru a... 04-03-2014, 12:19 AM
  1. #1
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,653

    Re: Excel vba - Loop thru a dynamic range, Find value does not go beyond second found valu

    Try this...

    Sub LastCellInColumnOffsetInsert()
            
        Dim rngSum As Range, FirstFound As String
        
        Set rngSum = Columns("I").Find(What:="SUM", _
                                       LookIn:=xlFormulas, _
                                       LookAt:=xlPart, _
                                       SearchOrder:=xlByRows, _
                                       SearchDirection:=xlNext, _
                                       MatchCase:=False)
                                       
        If Not rngSum Is Nothing Then
            FirstFound = rngSum.Address
            Do
                rngSum.Offset(0, -1).FormulaR1C1 = "=R[-1]C[-7] & ""  TOTAL"""
                Set rngSum = Columns("I").FindNext(After:=rngSum)
            Loop Until rngSum.Address = FirstFound
        End If
        
    End Sub
    This link is a good guide for the .Find method.
    The ultimate search
    Last edited by AlphaFrog; 04-02-2014 at 10:51 PM.
    Surround your VBA code with CODE tags e.g.;
    [CODE]your VBA code here[/CODE]
    The # button in the forum editor will apply CODE tags around your selected text.

+ 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. loop to find integers and decimals and pass found row to bookmark code.
    By beenbee in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-17-2014, 08:00 AM
  2. Loop through Column to find decimal then pass found row to bookmark code
    By beenbee in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 02-11-2014, 11:13 AM
  3. [SOLVED] nested loop for copying range: error no cells were found
    By Edejager in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 04-09-2013, 08:52 AM
  4. Dynamic Range using Offset, range not found for Pivot
    By GoneBaja in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 09-08-2012, 09:19 AM
  5. How to exit a loop once the value is found in the range
    By Suety in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 09-28-2010, 01:30 PM

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