Consulting

Results 1 to 13 of 13

Thread: Progress Bar - extend run time

  1. #1
    VBAX Newbie
    Joined
    Nov 2007
    Location
    Blaydon On Tyne, Newcastle
    Posts
    5
    Location

    Progress Bar - extend run time

    Hi All,

    My first time here and a total newbie to Macros/VBA and the like. Although I have been dabbling for a few weeks and have come on leaps and bounds. I am looking for some help regarding a progress bar I have added to a file at work. My apologies if this is long-winded.

    I have 1 excel file which is a direct download from SAP and another excel file which takes the information contained in the download and turns it into meaningful data.

    When I run the macro the following happens:

    1) Unwanted data (columns) from the download are removed and a filter is added to one of them.
    2) The data is filtered by a set of criteria then copied and pasted onto a worksheet in the breakdown. There are 3 bits of criteria each pasted onto 3 different sheets.
    3) The data pasted onto the 3 sheets then does a lookup to another file to autofill supplier information.

    All together the process moves anywhere from 100 to 2000 rows of data (depending on when in the month the download is done) and does a lookup of the same amount.

    I added a progress bar using the standard MS bars and the code suggested by johnske successfully. However, the bar only runs while the macro is sorting and moving the data, then freezes on the screen while the lookup is happening.

    Here's the crunch question - how, if possible at all, do I get the progress bar to run throughout the lookup process as well??

    I hope someone can help,

    Kind regards,

    Mick.

  2. #2
    Moderator VBAX Guru Simon Lloyd's Avatar
    Joined
    Sep 2005
    Location
    UK
    Posts
    3,003
    Location
    I'm not sure as i don't have the expertise to really point you in the right direction but a couple of things may help, [VBA]With Application
    .Calculation = xlManual
    .MaxChange = 0.001
    End With
    Application.EnableEvents=False[/VBA]at the start of your code and [VBA]With Application
    .Calculation = xlAutomatic
    .MaxChange = 0.001
    End With
    Application.EnableEvents=True[/VBA]at the end
    Regards,
    Simon
    Please read this before cross posting!
    In the unlikely event you didn't get your answer here try Microsoft Office Discussion @ The Code Cage
    If I have seen further it is by standing on the shoulders of giants.
    Isaac Newton, Letter to Robert Hooke, February 5, 1675 English mathematician & physicist (1642 - 1727)

  3. #3
    VBAX Newbie
    Joined
    Nov 2007
    Location
    Blaydon On Tyne, Newcastle
    Posts
    5
    Location
    Thanks for the response Simon,

    I'll give it a try.

    I don't have any expertise at this at all, so anything that might help is gratefully accepted. I am learning this as I go by downloading other peoples helpful ideas and hashing them around as best I can.

    I'll post back if it works.

    Mick.

  4. #4
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    Can you post a link to johnske's suggestion so that we can try it?
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  5. #5
    Moderator VBAX Guru Simon Lloyd's Avatar
    Joined
    Sep 2005
    Location
    UK
    Posts
    3,003
    Location
    also try this http://vbaexpress.com/kb/getarticle.php?kb_id=792 its by Mvidas (Matt)
    Regards,
    Simon
    Please read this before cross posting!
    In the unlikely event you didn't get your answer here try Microsoft Office Discussion @ The Code Cage
    If I have seen further it is by standing on the shoulders of giants.
    Isaac Newton, Letter to Robert Hooke, February 5, 1675 English mathematician & physicist (1642 - 1727)

  6. #6
    VBAX Newbie
    Joined
    Nov 2007
    Location
    Blaydon On Tyne, Newcastle
    Posts
    5
    Location
    Quote Originally Posted by xld
    Can you post a link to johnske's suggestion so that we can try it?

    Unfortunately, I can't post links yet, as I haven't made enough posts. You can find it if you search for progress bars using excel and johnske's name in the search criteria.

    Thanks for any help you can give,

    Mick.

  7. #7
    Moderator VBAX Guru Simon Lloyd's Avatar
    Joined
    Sep 2005
    Location
    UK
    Posts
    3,003
    Location
    Heres the Link
    Regards,
    Simon
    Please read this before cross posting!
    In the unlikely event you didn't get your answer here try Microsoft Office Discussion @ The Code Cage
    If I have seen further it is by standing on the shoulders of giants.
    Isaac Newton, Letter to Robert Hooke, February 5, 1675 English mathematician & physicist (1642 - 1727)

  8. #8
    VBAX Newbie
    Joined
    Nov 2007
    Location
    Blaydon On Tyne, Newcastle
    Posts
    5
    Location
    Simon,

    Many thanks for your help, unfortunately, the 1st idea didn't work. I couldn't get the IE progress bars to work at all, but I will put that down to my lack of knowledge and experience.

    Thanks anyway,

    Mick.

  9. #9
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    Can you post us a workbook to try with?
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  10. #10

    Subroutine parameters versus Public data

    Assuming I am calling a subroutine and sending it arguments, is it a two-way passing of data or is it better to use "public variables" if the sub is going to modify this data (logically send it back)? For example:
    [vba] Dim abc as Strng
    Dim xyz as String
    ...
    Call Sub1(abc, xyz)
    ...

    Sub1 (abc as String, xyz as String)
    ...

    abc = abc & "This is an added string of characters"
    ...

    End Sub [/vba]
    This is important DEPENDING on the way VBA allocates storage for variables. The alternative would be:

    [vba] Public abc as String
    Public xyz as String
    ...

    Call Sub1
    ...[/vba]

  11. #11
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    You should have started your own thread.

    It can be one way or two way, depending as to whetrher you pass the parameter by value or by reference.

    Try this

    [vba]

    Sub TestCalls()
    Dim abc As String, xyz As String

    abc = "abc"
    xyz = "xyz"
    Call Sub1(abc, xyz)
    MsgBox abc & vbNewLine & xyz

    abc = "abc"
    xyz = "xyz"
    Call Sub2(abc, xyz)
    MsgBox abc & vbNewLine & xyz
    End Sub

    Private Sub Sub1(ByRef abc As String, ByRef xyz As String)

    abc = abc & "This is an added string of characters"
    xyz = xyz & "This is an added string of characters"
    End Sub

    Private Sub Sub2(ByVal abc As String, ByVal xyz As String)

    abc = abc & "This is an added string of characters"
    xyz = xyz & "This is an added string of characters"
    End Sub
    [/vba]
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  12. #12

    I apologize for using this thread.

    I goofed. I thought I was creating a new thread, and I do apologize for any inconvenience I may have caused.

    Consider the issue closed. I do thank xld for his suggestion.

  13. #13
    VBAX Newbie
    Joined
    Nov 2007
    Location
    Blaydon On Tyne, Newcastle
    Posts
    5
    Location
    XLD,

    Sorry for the delay in replying to the thread, I have been away with work for a couple of days and the hotel didn't have a network I could connect to (not be using them again!!).

    I will try and upload the files tomorrow when I get back to work.

    Thanks for the help guys, it's much appreciated.

    Mick.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •