Consulting

Results 1 to 3 of 3

Thread: Quick VBA find question

  1. #1

    Quick VBA find question

    I have the below code, in the highlighted part im trying to search the entire row 'SourceHeaderDataRow' to find the cell that contains the text "ages"
    however i keep getting an error.
    Any ideas how i can fix this?
    thanks

        With ActiveSheet      ' do everything on the active sheet from here on
            Set DailyListStartFound = .Range("B:B").Find("Date", lookat:=xlWhole)
    
    
                If DailyListStartFound Is Nothing Then
                    MsgBox "Daily Table Start Point Not Found", 0, "Check Error"
                        Exit Sub
                End If
            
            SourceFirstDataRow = DailyListStartFound.Row + 1
            SourceHeaderDataRow = DailyListStartFound.Row
            
            Set DailyListEndFound = .Range(SourceHeaderDataRow).Find("Ages", lookat:=xlWhole)
            
                If DailyListEndFound Is Nothing Then
                    MsgBox "Daily Table End Point Not Found", 0, "Check Error"
                        Exit Sub
                End If

  2. #2
    Knowledge Base Approver VBAX Wizard p45cal's Avatar
    Joined
    Oct 2005
    Location
    Surrey UK
    Posts
    5,873
    change .Range to .Rows
    p45cal
    Everyone: If I've helped and you can't be bothered to acknowledge it, I can't be bothered to look at further posts from you.

  3. #3
    Thanks, worked a treat.
    Such a simple answer, had me puzzled for a while.

    Quote Originally Posted by p45cal View Post
    change .Range to .Rows

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •