Results 1 to 3 of 3
  1. #1
    mhatam is offline Novice
    Windows 10 Office 365
    Join Date
    Oct 2021
    Posts
    1

    VBA Code to Return Excel sheet row number

    Hi all,

    can anyone please let me know of code to return the row number of created Excel sheet of my MS Access based on the value from Access query? I was thinking of DLookup but seems that's only applicable for within MS Access not to import info from external Excel workbook

    any guidance is highly appreciated.

    thanks
    MH

  2. #2
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,933
    if you have a uniqueID column without gaps and the excel data is sorted on that column and you know which row the excel table starts on you could use the dcount function. Assuming the header is on the first row

    rownum=dcount("*","myExcelTbl","uniqueID<" & uniqueID)+1

    but you really have not explained the what and the why. What are you going to do with it once identified and why? There may be better ways of achieving what you want,

  3. #3
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,550
    You dont have to import the xl data, but you can just reference it.
    Link the excel sheet as an external table (no import)
    then you can still do the Dlookup, or Dcount.

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

Similar Threads

  1. Return Data From Excel Online Sheet
    By DMT Dave in forum Access
    Replies: 1
    Last Post: 05-28-2020, 02:04 PM
  2. Replies: 5
    Last Post: 04-25-2017, 01:38 AM
  3. Replies: 12
    Last Post: 03-26-2015, 10:42 AM
  4. Replies: 4
    Last Post: 01-24-2013, 06:30 PM
  5. Replies: 1
    Last Post: 05-01-2012, 03:52 AM

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