+ Reply to Thread
Results 1 to 21 of 21

How to determine version/file-format of file and num of max rows allowed of this file

  1. #1
    Forum Contributor
    Join Date
    12-01-2007
    Location
    USA-North Carolina
    MS-Off Ver
    MS Office 2016
    Posts
    2,662

    How to determine version/file-format of file and num of max rows allowed of this file

    Hi,

    I have a problem i am hoping someone can help me with. I have a macro which reads in a file. This file comes from 5 different users and all the users have different excel versions from excel 2003 to excel 2010.

    When i read in the file i want to check the number of rows used in the file. If for example someone who uses excel 2003 sends me a file and there are ~65,536 rows populated with data then i want send an alert to the screen saying something like "you are using the max number of rows in the file" please verify that you have populated the file correctly.........

    the problem is i am not sure how to do this? if i use the version ....the program just returns the version from which the macro is running.......which is not going to work because the person running the macro always uses excel 2010.

    Anyone have any ideas? also, if i have not explained this well please let me know and i will try to do better.

  2. #2
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Re: How to determine version/file-format of file and num of max rows allowed of this file


    Hi,

    just check Worksheet.Rows.Count

  3. #3
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,936

    Re: How to determine version/file-format of file and num of max rows allowed of this file

    Not sure that will work here (not sure what will though). This will test the rows in the current (active?) sheet, which, if the user has >=2007 will be over 1 million
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  4. #4
    Forum Contributor
    Join Date
    12-01-2007
    Location
    USA-North Carolina
    MS-Off Ver
    MS Office 2016
    Posts
    2,662

    Re: How to determine version/file-format of file and num of max rows allowed of this file

    rows.count wont work for the reason PMFDibbins mentioned.

    i am kinda stumped on this one.

  5. #5
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2405 Win 11 Home 64 Bit
    Posts
    23,888

    Re: How to determine version/file-format of file and num of max rows allowed of this file

    Try this:
    Please Login or Register  to view this content.
    EDIT: Posted before I read Ford's post. This won't help either.
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

  6. #6
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,936

    Re: How to determine version/file-format of file and num of max rows allowed of this file

    If all you want to do is ID what version was used, cant you just get a list of names and versions, and then base your code on the name? So if Joe Soap has 2003, your warning could be based on his name, as the source of the file

  7. #7
    Forum Contributor
    Join Date
    12-01-2007
    Location
    USA-North Carolina
    MS-Off Ver
    MS Office 2016
    Posts
    2,662

    Re: How to determine version/file-format of file and num of max rows allowed of this file

    no the people keep changing.......but good thought.....i guess there is no way to do this.

  8. #8
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,936

    Re: How to determine version/file-format of file and num of max rows allowed of this file

    Does the source of the files stay the same?

  9. #9
    Forum Expert
    Join Date
    10-06-2008
    Location
    Canada
    MS-Off Ver
    2007 / 2013
    Posts
    5,527

    Re: How to determine version/file-format of file and num of max rows allowed of this file

    Just hope that the last Column (in 2003) has no values.
    You'll have to refer to the WB you're getting the info from.
    Please Login or Register  to view this content.
    Disregard
    Same answer as "foo" code by alansidman
    Last edited by jolivanes; 10-13-2014 at 02:10 AM.

  10. #10
    Forum Contributor
    Join Date
    12-01-2007
    Location
    USA-North Carolina
    MS-Off Ver
    MS Office 2016
    Posts
    2,662

    Re: How to determine version/file-format of file and num of max rows allowed of this file

    what do you mean by source of files stay the same? Not sure what you mean.......

  11. #11
    Forum Guru romperstomper's Avatar
    Join Date
    11-04-2008
    Location
    A1
    MS-Off Ver
    Most
    Posts
    12,302

    Re: How to determine version/file-format of file and num of max rows allowed of this file

    You really ought to take Marc's advice.
    Remember what the dormouse said
    Feed your head

  12. #12
    Forum Contributor
    Join Date
    12-01-2007
    Location
    USA-North Carolina
    MS-Off Ver
    MS Office 2016
    Posts
    2,662

    Re: How to determine version/file-format of file and num of max rows allowed of this file

    using rows.count wont work.........

    if i save an excel 2003 file (where max rows is ~65k) and then run macro using my 2007 version the rows max value is not the 2003 limit but the 2007 limit.

  13. #13
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Exclamation Better checking before writing anything ‼


    Open a 2003 file on 2007 version and see ! Just scroll down to last row …
    Last edited by Marc L; 10-13-2014 at 08:24 AM.

  14. #14
    Forum Guru romperstomper's Avatar
    Join Date
    11-04-2008
    Location
    A1
    MS-Off Ver
    Most
    Posts
    12,302

    Re: How to determine version/file-format of file and num of max rows allowed of this file

    I don't think you read Marc's post properly then. If you use the Worksheet.Rows.Count property it will say how many rows there are on that sheet - with a sheet in a 2003 workbook, that will be 65536, regardless of which version of Excel you have the workbook open in.

  15. #15
    Forum Contributor
    Join Date
    12-01-2007
    Location
    USA-North Carolina
    MS-Off Ver
    MS Office 2016
    Posts
    2,662

    Re: How to determine version/file-format of file and num of max rows allowed of this file

    ok, i will try it. can someone send me an excel file created with excel 2003?

  16. #16
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Re: How to determine version/file-format of file and num of max rows allowed of this file


    You can create one yourself with Save As of 2007 (and above), basic Excel knowledge …

  17. #17
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2405 Win 11 Home 64 Bit
    Posts
    23,888

    Re: How to determine version/file-format of file and num of max rows allowed of this file

    Try this one attached.
    Attached Files Attached Files

  18. #18
    Forum Expert
    Join Date
    10-06-2008
    Location
    Canada
    MS-Off Ver
    2007 / 2013
    Posts
    5,527

    Re: How to determine version/file-format of file and num of max rows allowed of this file

    See Attached
    Attached Files Attached Files

  19. #19
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,936

    Re: How to determine version/file-format of file and num of max rows allowed of this file

    I just tested Rory,s statement, and iy works. .xls files opened in 20 only show ~65000 rows
    Attached Files Attached Files

  20. #20
    Forum Contributor
    Join Date
    12-01-2007
    Location
    USA-North Carolina
    MS-Off Ver
    MS Office 2016
    Posts
    2,662

    Re: How to determine version/file-format of file and num of max rows allowed of this file

    As usual you guys are right..........

    I just ran the following test. I am running excel 2007.

    From an xl2007 test macro i created I opened one of the xl2003 xls file sent to me. I then used the code

    Please Login or Register  to view this content.
    to identify the number of rows in the worksheet.........and the value shown was

    65536


    GREAT!!!!!!!! It worked!!!!!!!!!!!

    Thanks guys.........as always your great!!!!!!!!!!

  21. #21
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Arrow Re: How to determine version/file-format of file and num of max rows allowed of this file


    As I wrote 3 weeks ago in post #2 ! …

+ 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. ...more levels of nesting than are allowed in teh current file format
    By DExceler in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 03-25-2014, 12:54 PM
  2. [SOLVED] VBA code for opening a file with a variable version number in the file name
    By trishcollins in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 02-04-2014, 04:38 PM
  3. Replies: 4
    Last Post: 10-23-2013, 12:54 AM
  4. Formula Uses More Levels Of Nesting Than Are Allowed In Current File Format
    By tronix_Country in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 02-16-2012, 07:39 PM
  5. How to: Open file, format data, save file, close file and repeat.
    By thexeber in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 09-11-2010, 12:56 PM

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