Loading
Ozgrid Excel Help & Best Practices Forums

Excel Video Tutorials / Excel Dashboards Reports



Page 1 of 2 1 2 LastLast
Results 1 to 10 of 12

Thread: vba automatic reset - how to?

  1. #1
    Join Date
    22nd April 2005
    Posts
    5

    vba automatic reset - how to?

    Hi,
    When I RUN my VBA code from the code page & hit RESET first it works fine.
    When I run my sub main from my macro button on a spread-sheet without first hitting the RESET button on the code page it doesn't work properly.
    Is there a way to achieve RESET without manually going back into the code page to do it?
    Or alternatively, what might i be doing wrong?
    Thanks for any help
    ozwi (David Bennet)

    Excel Video Tutorials / Excel Dashboards Reports


  2. #2
    Join Date
    7th March 2003
    Location
    Essex, England
    Posts
    11,313

    Re: vba automatic reset - how to?

    Hi,

    It's impossible to tell what you might be doing wrong unless you can post your code and or an example workbook.

    Cheers
    Andy


  3. #3
    Join Date
    22nd April 2005
    Posts
    5

    Re: vba automatic reset - how to?

    Thanks for the reply Andy.
    Actually my main question is code independent - ie how how to do a reset without having to manually hit the reset button in the code window.
    I've given up on that because nobody else in the universe seems to have had that problem.
    I've solved my initialization problem by:
    (1) dealing with a certain static variable, &
    (2) initializing Rnd properly for repeatable rn sequences
    All this would have been obviated by a programmatic reset.
    cheers
    ozwi

    Excel Video Tutorials / Excel Dashboards Reports


  4. #4
    Join Date
    26th January 2003
    Location
    UK
    Posts
    4,682

    Re: vba automatic reset - how to?

    Bump
    Last edited by Jack in the UK; May 13th, 2005 at 09:07.

    Excel Video Tutorials / Excel Dashboards Reports


  5. #5
    Join Date
    26th January 2003
    Location
    UK
    Posts
    4,682

    Re: vba automatic reset - how to?

    Ozwi
    I would like to welcome You to OzGrid i have a couple of points as well, i ask You please take note of what i am saying -

    I find in my opinion your comments
    I've given up on that because nobody else in the universe seems to have had that problem.
    totally unacceptable - there is no reason for this regardless of what You think or feel, all us guys work for free OK! Requests have been made to help You and You do not take up this advice, that’s extremely rude / flippant and I do not want to read anything like this again.


    Back to Your question:
    I do not know of a 'RESET button' i assume that this is one of two things the VBE Stop button or a command button You have made.

    If the stop button i assume Your code has error and is bugging / crashing out, i can not assist unless You post the code, Andy has requested a look at the code to see if he can un-pick such a problem for You, Yet You say the comments i have quoted above! So how do You know that? You have not given the chance to anyone.

    If it is a command button i assume You have cells / fields / userforms that are active so need to be reset to null values so the new math executes or the DataStream is new data only, this is a mine filed without something to go on.

    If You want help please answer the questions and post the code so we can try the code our end.

    EDIT: Reading Your post again
    initialization problem by:
    I assume You have a userform that is active so I assume You have not set the useform up correctly so debugs, You need to structure the userform so that all issues are taken care of, they are extremely powerful but tricky at first – takes some love and care to get working just right

    Maybe set the code on open to wipe / reset and run the code to set the values / math, and is needs be at the end do the same, a bit over kill and all codes if no longer required should be dropped from memory and things returned to original state after the procedures run, otherwise that poor practice, and such issues can pop up, I can not advise more with the information I have

    Jack

    Excel Video Tutorials / Excel Dashboards Reports


  6. #6
    Join Date
    22nd April 2005
    Posts
    5

    Re: vba automatic reset - how to?

    Thank you for your reply.
    I've fixed my problem by more careful initialisation as mentioned above.
    I would still be interested to know if it is possible to reset other than with the code window 'reset' button - but the issue is no longer critical to me.
    I've done a fairly extensive web search & can't seem to find anyone in that 'universe' who has addressed my reset button problem.
    BTW the 'reset' button is the one with the little square icon on the run menu.
    regards
    ozwi

    Excel Video Tutorials / Excel Dashboards Reports


  7. #7
    Join Date
    29th December 2004
    Location
    Philipp
    Posts
    113

    Re: vba automatic reset - how to?

    try pressing ctrl break in the keyboard simultaneously

    Excel Video Tutorials / Excel Dashboards Reports


  8. #8
    Join Date
    26th January 2003
    Location
    UK
    Posts
    4,682

    Re: vba automatic reset - how to?

    Ozwi
    'VBE Stop button' as my earlier post is what i thing Your discribing - no this can not be poked in any way that i know of, this question has been asked many times before and i have never seen a fix for this.

    jiuk

    Excel Video Tutorials / Excel Dashboards Reports


  9. #9
    Join Date
    7th March 2003
    Location
    Essex, England
    Posts
    11,313

    Re: vba automatic reset - how to?

    Well here's the fix
    VB:
    Dim cbrReset As CommandBarButton 
     
    Set cbrReset = Application.VBE.CommandBars(1).Controls("&Run").Controls("&Reset") 
    cbrReset.Execute 
    
    
    But I still think there is a fundemental problem that needs solving if you have to resort to this.

    Cheers
    Andy


  10. #10
    Join Date
    26th January 2003
    Location
    UK
    Posts
    4,682

    Re: vba automatic reset - how to?

    Andy nice touch erm teach us all again many thanks for Your kindness - wicked!
    But I still think there is a fundemental problem that needs solving if you have to resort to this.
    As i posted before:
    i assume Your code has error and is bugging / crashing out,
    Not so sure i would use this unless to force and issue but that really bounces back to teh above of some shocking code being used, the first port of call is to make teh procedure(s) run correctly - otherwise many off results could be returned and funny actions taken, can end up all a little un-expected.

    Cheers Andy

    jiuk

    Excel Video Tutorials / Excel Dashboards Reports


Thread Information

Users Browsing this Thread

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

Possible Answers

  1. Reset to zero
    By andyjw in forum EXCEL HELP
    Replies: 10
    Last Post: June 6th, 2006, 04:34
  2. Reset Scheme
    By Runes in forum Excel and/or Access Help
    Replies: 1
    Last Post: May 8th, 2006, 23:13
  3. On Error reset
    By HHawken in forum EXCEL HELP
    Replies: 2
    Last Post: August 2nd, 2005, 02:30
  4. Worksheet Automatic Name Reset
    By PatrickC in forum EXCEL HELP
    Replies: 4
    Last Post: July 24th, 2005, 21:08
  5. VBA: checkboxes reset
    By xlite in forum EXCEL HELP
    Replies: 1
    Last Post: October 13th, 2003, 23:18

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
  •  
porno