+ Reply to Thread
Results 1 to 2 of 2

VBA to search for number and return in specific area of spreadsheet

  1. #1
    Registered User
    Join Date
    10-19-2017
    Location
    Fort Saskatchewan, Alberta, Canada
    MS-Off Ver
    2010
    Posts
    10

    VBA to search for number and return in specific area of spreadsheet

    I am having troubles with the code below. I want it to be linked to a button and findings shown in a list below the selection button.
    -------------------------------------------------------------------------------------------------------------------------------------------------
    NUMBER
    910801

    PROJECT NUMBER PLANT PROJECT NAME EQUIPMENT NUMBER OTHER REF # FILE YEAR

    -------------------------------------------------------------------------------------------------------------------------------------------------

    910801 is in a drop down list and resides in J2. I have a "Find Data" button to the right of the "NUMBER" word. It is linked to the vba coding Sheets.finddata. I want the information when found to be put starting in cell J5.

    The error I get is "Object doesn't support this property or method". I'm not sure where to go from here. The vba coding is below:


    Sub finddata()

    Dim number As String
    Dim finalrow As Integer
    Dim i As Integer

    Sheets("Data").Range("j5:p50").ClearContents

    number = Sheets("Data").Range("j2").Value
    finalrow = Sheets("Data").Range("A1000").End(x1up).Row

    For i = 2 To finalrow
    If Cells(i, 1) = number Then
    Range(Cells(i, 0), Cells(i, 6)).Copy
    Range("j100").End(xlUp).Offset(1, 0).PasteSpecial xlPasteFormulasAndNumberFormats
    End If

    Next i

    Range("j2").Select


    End Sub

    Thanks....Laurie

  2. #2
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: VBA to search for number and return in specific area of spreadsheet

    Hi Laurie

    Welcome to the Forum!!!

    Please wrap any Code you post with Code Tags...it's a Forum Requirement.

    I'd look at this Line of Code...Column 0 (zero)???
    Please Login or Register  to view this content.
    John

    If you have issues with Code I've provided, I appreciate your feedback.

    In the event Code provided resolves your issue, please mark your Thread as SOLVED.

    If you're satisfied by any members response to your issue please use the star icon at the lower left of their post.

+ 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. Replies: 3
    Last Post: 06-13-2017, 02:46 AM
  2. [SOLVED] Return Multiple Items to specific area
    By sonny8488 in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 07-31-2016, 01:46 PM
  3. Index/Matching area arrays, or searching array for specific number
    By bcwilliam87 in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 04-06-2015, 07:30 PM
  4. [SOLVED] Search for a value in a workbook, and return the Spreadsheet name where it was located.
    By Quilie19 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 04-04-2015, 05:51 PM
  5. Replies: 4
    Last Post: 08-15-2013, 09:50 AM
  6. Replies: 7
    Last Post: 07-28-2011, 10:05 AM
  7. [SOLVED] Search for a number in a table and return data of a specific cell
    By Karaman in forum Excel General
    Replies: 4
    Last Post: 06-30-2006, 10:50 AM

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