+ Reply to Thread
Results 1 to 7 of 7

Working with ranges

  1. #1
    Registered User
    Join Date
    12-09-2017
    Location
    Israel
    MS-Off Ver
    Office Excel 2007
    Posts
    28

    Working with ranges

    Hello all,
    I need some advice here..
    I've read that if you use vba to read from and write to a range in a sheet, it is much slower, and that it's a much faster (better?) way to load the range to an array first and work with that array instead of directly referring the range in the worksheet for stuff, every time. I tried loading a range to array but I found that the values are the only thing the array get populated with.

    Something like:
    Please Login or Register  to view this content.
    What I need is to gather other properties about each cell in the range I load and not only cell values. Is it possible to load the individual cells as ranges so that I can then check whatever I need in each cell, via the array? Would that make it faster (better performance wise) as oppose to reading directly from the spreadsheet? Or is it be better if I create a custom type that holds only the specific properties (and load them to array)? I only need: front used in the cell, value of cell, cell formula, cell row, cell column, isRowHidden, and isColumnHidden
    I only need these ones so loading an entire cell's (range) property set might be redundant..

    Two more things to consider:
    1. Range size can vary greatly - at times the range to load could be only a few cells, in other times few hundred or even thousand cells.

    2. The loaded properties shouldn't only be static, that is, except for cell row and cell column (which would help me locate the cpecific cell to apply changes to), all other 5 properties should have an affect in the sheet itself (if I load a range where A23 is using Arial, I would be able to set a different font, via a userform).

    I'm not concerned about any of the other things I've mentioned like userform and affecting the sheet via a form..

    My concern here is:
    What is the easiest/best way (performance wise, on the system) to work with potentialy large ranges, where you'd need to read and write to a spreadsheet?

    Thanks!
    Last edited by guyglk; 01-09-2020 at 03:21 AM.

  2. #2
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Ipswich, England
    MS-Off Ver
    Office 365 (Win 10 - Work) & Office 365 Subscription Insider (Win 10 - Home)
    Posts
    36,042

    Re: Working with ranges

    Just to clarify, as you have posted in the Access section - is this an Access or an Excel question?
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!

    Forum Rules (updated September 2018): please read them here.
    How to use the Power Query code you've been given: help here. More about the Power suite here.
    Don't forget to say "thank you" to those who have helped you in your thread. If you wish, you can also reward them by clicking on their reputation star bottom left.

  3. #3
    Registered User
    Join Date
    12-09-2017
    Location
    Israel
    MS-Off Ver
    Office Excel 2007
    Posts
    28

    Re: Working with ranges

    Oh sorry.. it is an excel question, please disregard.
    I'll re-post this in the excel sect.

    Thanks!

  4. #4
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Ipswich, England
    MS-Off Ver
    Office 365 (Win 10 - Work) & Office 365 Subscription Insider (Win 10 - Home)
    Posts
    36,042

    Re: Working with ranges

    No - I'll move the thread for you.

  5. #5
    Registered User
    Join Date
    12-09-2017
    Location
    Israel
    MS-Off Ver
    Office Excel 2007
    Posts
    28

    Re: Working with ranges

    Thanks but already did.. hope it's OK..

  6. #6
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Ipswich, England
    MS-Off Ver
    Office 365 (Win 10 - Work) & Office 365 Subscription Insider (Win 10 - Home)
    Posts
    36,042

    Re: Working with ranges

    No, it wasn't OK - you aren't allowed duplicates (see forum rule #5). I have deleted the new thread and moved this one, so continue here, please.

  7. #7
    Registered User
    Join Date
    12-09-2017
    Location
    Israel
    MS-Off Ver
    Office Excel 2007
    Posts
    28

    Re: Working with ranges

    Thank you AliGw

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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