+ Reply to Thread
Results 1 to 13 of 13

more effective script

  1. #1
    Forum Contributor
    Join Date
    09-02-2013
    Location
    Netherlands
    MS-Off Ver
    Office 365 (2013)
    Posts
    268

    more effective script

    Hi All,

    Since I can't get my screen to lock in openoffice (while using VBA), I have to find another way to speed things up.
    As you can see below, my scripting is very very poor and I was wondering how I can speed up the script.

    I was thinking about tricks to let it run faster, but I don't really come up with solutions.


    Please Login or Register  to view this content.
    Last edited by Evolta; 12-04-2013 at 09:14 AM.

  2. #2
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,644

    Re: more effective script

    The first loop could be done in one line.
    Please Login or Register  to view this content.
    If posting code please use code tags, see here.

  3. #3
    Forum Contributor
    Join Date
    09-02-2013
    Location
    Netherlands
    MS-Off Ver
    Office 365 (2013)
    Posts
    268

    Re: more effective script

    Quote Originally Posted by Norie View Post
    The first loop could be done in one line.
    Please Login or Register  to view this content.
    Nice
    I added iRow, jRow, kRow, lRow so I don't have to find the last row the whole time. That made things faster too (but now I notice it only adds 1/3th of the entries )
    Noticed that by trying things I just removed 2/3th of my data... put it back and noticed no speed difference >.<
    Last edited by Evolta; 12-04-2013 at 09:40 AM.

  4. #4
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,644

    Re: more effective script

    What I posted is a direct replacement for the loop it shouldn't cause any change in what the rest of the code does.

  5. #5
    Forum Contributor
    Join Date
    09-02-2013
    Location
    Netherlands
    MS-Off Ver
    Office 365 (2013)
    Posts
    268

    Re: more effective script

    Quote Originally Posted by Norie View Post
    What I posted is a direct replacement for the loop it shouldn't cause any change in what the rest of the code does.
    True, but my own change messed things up full script is working again, just not so fast.
    Can imagine that this can be done much faster (does not have to be shorter in script). But I don't know how

  6. #6
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,644

    Re: more effective script

    So you are using the the code I posted but it makes no difference?

    What, in words, is the code meant to do?

  7. #7
    Forum Contributor
    Join Date
    09-02-2013
    Location
    Netherlands
    MS-Off Ver
    Office 365 (2013)
    Posts
    268

    Re: more effective script

    Delete previous values in Sheet B
    Copy all unique values from Sheet A (columns C,D,E,H) to Sheet B (columns A,B,C,D) that have a length of more then 1

    +remove some older input fields
    +count the last row number of Sheet B
    Last edited by Evolta; 12-04-2013 at 09:52 AM.

  8. #8
    Forum Contributor
    Join Date
    09-02-2013
    Location
    Netherlands
    MS-Off Ver
    Office 365 (2013)
    Posts
    268

    Re: more effective script

    The reason why I need it:
    Column 1: Validation for cell x
    Column 2: Validation for cell y
    Column 3: Validation for cell z
    Column 4: Validation for cell a

    Based on the selection on x,y,z,a another macro will run

    I was thinking that maybe with a formula in the validation the same thing can be achieved
    - if length is more then 1
    - Sort ascending (will automatically remove duplicates)

    Someone knows if and how this can be done?
    Last edited by Evolta; 12-04-2013 at 11:34 AM.

  9. #9
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,644

    Re: more effective script

    If you want to copy unique values with length > 1 then you could use advanced filter.

  10. #10
    Forum Contributor
    Join Date
    09-02-2013
    Location
    Netherlands
    MS-Off Ver
    Office 365 (2013)
    Posts
    268

    Re: more effective script

    Quote Originally Posted by Norie View Post
    If you want to copy unique values with length > 1 then you could use advanced filter.
    Been looking for that, but can't get it to work (might be because OpenOffice doesn't support it, or because I'm using it wrong)

  11. #11
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,644

    Re: more effective script

    OpenOffice does support advanced filtering and as far as I know it works much the same as advanced filter in Excel, manually anyway.

  12. #12
    Forum Contributor
    Join Date
    09-02-2013
    Location
    Netherlands
    MS-Off Ver
    Office 365 (2013)
    Posts
    268

    Re: more effective script

    Can't get it to work :'(


    Naamloos.jpg

  13. #13
    Forum Contributor
    Join Date
    09-02-2013
    Location
    Netherlands
    MS-Off Ver
    Office 365 (2013)
    Posts
    268

    Re: more effective script

    I'm thinking about persuading them to buy Excel2010 and if they don't want to spend money on it, I might buy it for them myself.

    Change my ods file to xlsm. Had to redo all formatting and had to take a look at the macro's. (still working on getting it back to the way it was working before the change).

    AdvancedFilter now ofcourse is working, BUT it seems to fail on 1 column
    Please Login or Register  to view this content.
    Column E in ws to Column C in VA remains blank, but there are of course more then enough unique files.

    Now I still don't know how to get the filter: If length > 1 then copy
    And I don't know why that one column is being a ***** (If I add a testvalue in E3, then it does work.. But I don't want that -.-)

    Any help is welcome; (I use Excel2010, VBA script now)


    -- update --
    Changed the script a little so that Column E does work. For the length > 1; still no solution found :/
    Please Login or Register  to view this content.
    Tried something like above
    Last edited by Evolta; 12-06-2013 at 05:44 AM.

+ 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. Need help finding the effective rate of return, Where:
    By Relim in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 12-16-2011, 11:10 AM
  2. Effective Interest Rate formula
    By jonrayworth in forum Excel General
    Replies: 1
    Last Post: 05-08-2009, 01:49 PM
  3. [SOLVED] effective gross income
    By Ror in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 03-10-2006, 04:20 AM
  4. More effective code
    By Roman in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-27-2005, 12:05 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