Results 1 to 3 of 3

Run-time error '91' while using Find

Threaded View

  1. #1
    Registered User
    Join Date
    08-04-2011
    Location
    Hillsboro, OR
    MS-Off Ver
    Excel 2003
    Posts
    14

    Run-time error '91' while using Find

    The code continues beyond what I put in here but it is not important. When the code reaches the dataobj.range line of code, I get this error. Any ideas why it is happening?

    Sub stacknew()
    
    Dim dataobj As Object
    Dim start
    Dim newstart
    Dim finish
    Dim stackx
    Dim X As Double
    Dim c As Double
    Dim i As Double
    Dim keepx
    Dim nsheet
    Dim Data As String
    
    
     'printobj.Activate
      
        Set dataobj = ActiveWorkbook.ActiveSheet
      
      'goes to the specified subroutines and identifies the last row and column in the sheet
      X = lastrowN()
      c = lastcolN()
      
      'This loop is designed to be flexible with changes to the columns leading the raw data.
      'So that the leadig column is always the column with the "SD-1" header
        Data = "SD-1"
        start = 1
        'For p = 1 To c
          ' If dataobj.Cells(1, p) <> Data Then p = p + 1
    
            dataobj.Range(Cells(1, 1), Cells(1, c)).Find("SD-1", LookIn:=xlFormulas, LookAt:=xlWhole).Activate
            If Err.Number = 0 Then
                FTemp = dataobj.Cells(ActiveCell.Row, DataCol).Address
            Else
                FTemp = "???"
            End If
    Last edited by Mordred; 08-08-2011 at 12:45 PM.

Thread Information

Users Browsing this Thread

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

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