Results 1 to 7 of 7
  1. #1
    DMT Dave is offline VIP
    Windows 10 Access 2016
    Join Date
    May 2018
    Posts
    1,365

    Finding Excel Row

    Hi Guys, is there a method of finding what row number specific text is on Excel when it's open on MS One Drive ?



    ie: 123 is in row 14 column B

    Access to return 123 is on 14

    Best Regards

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,550
    row# has no meaning in Access. Its relative.
    if you do it in excel, do a find, then msgbox activecell.row

  3. #3
    DMT Dave is offline VIP
    Windows 10 Access 2016
    Join Date
    May 2018
    Posts
    1,365
    Hi ranman256, thank you for your reply

    The issue i am having is the file is on one drive, therefore i am trying to use

    With XLWB then if i use .activeworbook.activecell for example

    am i right in thinking because it's on one drive that the workbook is not active as the path is a http: web address and not a local drive ?

  4. #4
    Gicu's Avatar
    Gicu is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jul 2015
    Location
    Kelowna, BC, Canada
    Posts
    4,250
    Not really as the path should be something like C:\Users\YourUserName\SkyDrive\Documents. You can check by opening an Excel file in your OneDrive and going into code and in the debug window do debug.print Application.ActiveWorkbook.Path

    Cheers,
    Vlad

  5. #5
    DMT Dave is offline VIP
    Windows 10 Access 2016
    Join Date
    May 2018
    Posts
    1,365
    Thank you Vlad, briefly how do i do this bearing in mind i am guest user ???

    Much appreciated

  6. #6
    Gicu's Avatar
    Gicu is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jul 2015
    Location
    Kelowna, BC, Canada
    Posts
    4,250
    Sorry, didn't know you're guest, if you only have access via a link I don't know if you can.

  7. #7
    accesstos's Avatar
    accesstos is offline Expert
    Windows XP Access 2007
    Join Date
    Dec 2018
    Location
    Greece
    Posts
    551
    You do not have to deal with active objects if you want to retrieve only a value from a workbook. These belongs to the UI.
    The sample below will probably give you what you want.
    Code:
    Public Function FindExcelRow(ByVal strWBFileSpec As String, varValue As Variant) As Long
        'A reference to the "Microsoft excel 12.0 object library" (or greater) is required
        Dim XL As Excel.Application
        Dim WB As Excel.Workbook
        
        Set XL = New Excel.Application
        XL.Visible = False
        On Error Resume Next
        Set WB = XL.Workbooks.Open(strWBFileSpec, , -1)
        If WB Is Nothing Then
            MsgBox "Workbook not found!", vbExclamation
        Else
            FindExcelRow = XL.WorksheetFunction.Match(varValue, WB.Sheets(1).UsedRange.Range("B:B"), 0)
            WB.Close False
            Set WB = Nothing
        End If
        Set XL = Nothing
    End Function

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 1
    Last Post: 05-22-2018, 07:47 AM
  2. Finding and updating cells in an Excel worksheet
    By GraeagleBill in forum Programming
    Replies: 12
    Last Post: 01-10-2018, 06:55 PM
  3. Finding Coordinates
    By QuickJeff in forum Queries
    Replies: 6
    Last Post: 07-04-2016, 01:58 AM
  4. Replies: 2
    Last Post: 02-10-2016, 09:15 AM
  5. finding a value in a recordset
    By TheShabz in forum Programming
    Replies: 9
    Last Post: 04-23-2010, 02:44 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums