to an immediate module say Module 1 ( back and forth) and access to other macros in other modules may be through "Form" buttons ? My code in Sheet2 is as follows:
Please Login or Register to view this content.
to an immediate module say Module 1 ( back and forth) and access to other macros in other modules may be through "Form" buttons ? My code in Sheet2 is as follows:
Please Login or Register to view this content.
Hi omega,
Your question is a little different than your code. In your thread question you ask about shifting from worksheet to worksheet.
In VBA there are different places to put your code. If it is behind a worksheet (not in a main module) it should only work on THAT sheet.
If it is in a MODULE that is not behind a worksheet it should work for any sheet.
To learn more you need to read two websites:
http://www.cpearson.com/Excel/SheetNameFunctions.aspx
http://www.cpearson.com/Excel/Scope.aspx
Understanding where the VBA goes to deal with your problem is important to know.
I think learning the above linked information will allow you to solve your own question.
One test is worth a thousand opinions.
Click the * Add Reputation below to say thanks.
I am trying to read and understand from sources that you have given. Thanks for the same. But, can you tell me that in the above example if IMMwFU was replaced by its actual content i.e
Application.EnableEvents = False
Range("FI109").Copy
Range("fJ109").PasteSpecial Paste:=xlPasteValues
Range("FI122:FI124").Copy
Range("fJ122").PasteSpecial Paste:=xlPasteValues
Application.EnableEvents = True
...... Then will the code run faster ?
Last edited by omega0010; 08-29-2015 at 01:23 PM.
Hi omega,
Look at the cell FJ109 before running your code. If the formula bar shows a formula, it is being calculated. Then after you run the code using "xlPasteValues" look at the cell again. If it now only shows a number then the code has worked as the formula was converted to a value.
Will the code run faster is a hard question. Most of Excel code runs very fast. Fast enough that it is hard to time. I don't know how to answer this part of the question.
Thanks MarvinP ! I don't know much about codes and I do not have any formal "education" on in this subject, But, by Logic I think that If the code is in the Sheets main page then in the original instance of the code as soon as Fj109 <-3 or > 3 then it will have to go to the code which is in another module and then come back to the main sheet code to complete rest of the codes .....BUT in the second instance where in the main sheets code the detail of the code(IMMWFU) is added then it does not have to go to the "other module" to do what it has to AND actually gets it done right away ! What do you think ?
There is a clear and visible delay in the code as sometimes the lower codes of the main sheet does not get executed ( up-to 2-3 cycles of the "AA" code) and upto 10-15 secs .... Now since you are an expert I will give you another diagnostic tool in this relation. The first code "AA" is actually set to run @ the titration of every 5 seconds ( i.e Now() is copied and if de2 (=Now()-preiously pasted value) > d3(=time(0,0,05)) then the code "AA" runs).
Is it possible that because of this, the running code is interrupted, and thus the visible delay in the end codes(below like RPRIMM etc) ? All my codes are of similar length except "AA" which takes about 2 secs to execute( I don't know how to check the speed of a macro but this is my observation. I and the other readers will be obliged if there is a reference reading help from you. Thanking you again for your kindness, time and effort ...... God Bless!
Last edited by omega0010; 08-30-2015 at 01:38 AM.
Hi omega,
See if putting in a screenupdating = false statement in your code makes it run faster/better.
http://www.excel-pratique.com/en/vba...enupdating.php
Or put a timer in your code and call it between your if statements. Instead of putting the time in a msgbox, send it to the Immediate Window using a Debug.Print statement. This will allow you to see how much time each part of your code is taking. See
https://www.youtube.com/watch?v=04tN52ubrEE
for a video of what I'm saying.
Thanks for your patience and help !
It is very kind of all of you in the Forum to teach novices like me and others and share your knowledge and experience !
My GURU who was a very big composer in India said to me " The true owners of wealth and knowledge are those who share it with others !" ... I salute you all and specially the originators and coordinators of this great forum !
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks