+ Reply to Thread
Results 1 to 6 of 6

matching row number value with part of file name

  1. #1
    Registered User
    Join Date
    12-15-2014
    Location
    singapore
    MS-Off Ver
    2013
    Posts
    45

    matching row number value with part of file name

    Hi, I have a row value of 1013000 1016000 and so on, My file name contains Buoy1_1013000.

    May I know how do Modify my code example the Do While Cells(i , 1 ).Value = FileName by matching just the 1013000, not the whole string.

    This is how I open my File

    Please Login or Register  to view this content.

    And this is where i want to edit my code. Thanks!!

    Please Login or Register  to view this content.

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

    Re: matching row number value with part of file name

    Get seven characters starting at position #7 in the file name.

    Please Login or Register  to view this content.
    Ben Van Johnson

  3. #3
    Registered User
    Join Date
    12-15-2014
    Location
    singapore
    MS-Off Ver
    2013
    Posts
    45

    Re: matching row number value with part of file name

    Thanks! Can I get the 1st seven character of my cells value let's say Cell (5,1) to cell (8,1) all have the value of 20141101****. I want to to read the file of 20141101**** as well. Thanks!

  4. #4
    Registered User
    Join Date
    12-15-2014
    Location
    singapore
    MS-Off Ver
    2013
    Posts
    45

    Re: matching row number value with part of file name

    Hi I tried but it returns error on the code.

    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    12-15-2014
    Location
    singapore
    MS-Off Ver
    2013
    Posts
    45

    Re: matching row number value with part of file name

    Hi I tried new way to do it but still can't. Error at the if mid function. Help, thanks

    Please Login or Register  to view this content.
    [/QUOTE]

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

    Re: matching row number value with part of file name

    The Mid() function has three (arguments) parameters
    * The string to extract the sub-string from
    * the starting position and
    * the number of characters to return

    Notice that in your code: Mid(cells(I, 1),0, 8)
    you are trying to start at position zero in the string; that's an error. the number must be one or larger; but it can't be larger than the actual length of the test string.

    substring = MID(teststring, starting position, num chars to fetch)
    Last edited by protonLeah; 12-17-2014 at 04:12 PM.

+ 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. Help returning part number 1 time and adding up like part number QTY
    By SOLERSA in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 09-16-2014, 06:31 AM
  2. Decrease serial number if matching file found
    By beenbee in forum Excel Programming / VBA / Macros
    Replies: 16
    Last Post: 01-06-2014, 10:30 AM
  3. Decoding a part number Vs. Read/Write from DB file
    By hockeyadc in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 07-22-2013, 03:27 PM
  4. Advanced lookup matching part of a number
    By MayfairBlue in forum Excel Formulas & Functions
    Replies: 24
    Last Post: 08-16-2012, 08:30 AM
  5. Retrieving File Name by Matching a Given Page Number in a Book
    By ExcelTip in forum Tips and Tutorials
    Replies: 0
    Last Post: 08-25-2005, 02:23 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