+ Reply to Thread
Results 1 to 6 of 6

VBA to find cell with a specific value, and ID its coordinates

  1. #1
    Registered User
    Join Date
    04-27-2012
    Location
    Canberra
    MS-Off Ver
    Excel 2010
    Posts
    19

    VBA to find cell with a specific value, and ID its coordinates

    hi again

    need help with finding a cell which contains a number, in a column (ie not the WHOLE sheet) and ID the cell's coordinates in number number form, instead of letter number, and be able to use those numbers. like when you say, activesheet.cells(row, col) instead of activesheet.range("a3") etc. i will need to be able to use the coordinates of the cell

    the number has been calculated inside vba itself, don't need to worry about that

    It also needs to be able to be used on different sheets.

    thank you so much!

  2. #2
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    WinXP/MSO2007;Win10/MSO2016
    Posts
    12,086

    Re: VBA to find cell with a specific value, and ID its coordinates

    Where's the code you're using at this point??
    With SomeRange
    Set Results = .Find(...
    End With
    x = Results.Row
    y = Results.Column
    Ben Van Johnson

  3. #3
    Registered User
    Join Date
    04-27-2012
    Location
    Canberra
    MS-Off Ver
    Excel 2010
    Posts
    19

    Re: VBA to find cell with a specific value, and ID its coordinates

    Quote Originally Posted by protonLeah View Post
    Where's the code you're using at this point??
    as in what code I've been using so far to find the cell and its coordinates? i haven't cuz i have no idea how to
    i tried using the set results = .find( thing i want to find) method but am i doing it wrong, it points to set results and says "Object Required"

  4. #4
    Registered User
    Join Date
    04-27-2012
    Location
    Canberra
    MS-Off Ver
    Excel 2010
    Posts
    19

    Re: VBA to find cell with a specific value, and ID its coordinates

    ok, some success, i declared results of Range and no object error NICE

    so i tested the function out with f8 and find that its not searching within the range i set it:
    With ActiveSheet.Range(Cells(15, 19), Cells(19, 19))

    it returns me results (which are correct) but are in the wrong part of the workbook

    ie it finds the same at 3,10 when i have put it in 16,19

    thoughts?

    my code so far:

    Sub findvalue()
    With ActiveSheet.Range(Cells(15, 19), Cells(19, 19))
    Dim Results As Range
    Dim x As Long
    Dim y As Long

    Set Results = Cells.Find(5)

    x = Results.row
    y = Results.Column
    End With

    Debug.Print x, y


    End Sub

  5. #5
    Registered User
    Join Date
    04-27-2012
    Location
    Canberra
    MS-Off Ver
    Excel 2010
    Posts
    19

    Re: VBA to find cell with a specific value, and ID its coordinates

    http://www.ozgrid.com/VBA/find-method.htm found a solution

    thanks man

  6. #6
    Registered User
    Join Date
    04-27-2012
    Location
    Canberra
    MS-Off Ver
    Excel 2010
    Posts
    19

    Re: VBA to find cell with a specific value, and ID its coordinates

    SOLVED,

    i used cells.find(thing i wanted, after (cell coordinates), xlrow )

+ Reply to Thread

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