×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Does anyone know what this code is doing?

Does anyone know what this code is doing?

Does anyone know what this code is doing?

(OP)
Hi guys.

I am pmmd861, I am new here. Nice to meet you all!

Could anyone help me with this VBA Excel code, please?

So, i ve got the excel spreadsheet from someone else, and i need to nuderstand the code there so that i could slightly rebuild it in the future. But there is some piece of code that i ve never seen and i have no idea how it works!

Here is the extract from the program.

In the Calibrate sub i have the code


 

CODE

Sheets("EL 1").Select
    Range("H9").Select
    ActiveCell.FormulaR1C1 = "1"

This bit is simple.

But when

CODE

ActiveCell.FormulaR1C1 = "1"

is executed the code changes the value in the cell H9 AND after that CALLS the user defined FUNCTION in another module! My question is WHY? This is not how you call the function, right? Does it have something to do with windows programming language (i think it called API functions)?

Also, it repeats the function many times, as if it is driven by some external loop (but there is no any cpde the loop).

I tried to delete ALL the code in ALL modules and just to leave this bit - it still call the function in the same way.

Also, there is the same code for another sheet, but on that sheet when one cell is changes it calls the functuion and when another cell is changed it does NOT call this function? PLease, give me a hint where to look for the answer! I searched for Application. properties in the code and in the ThisWorkbook module and didnt find anything! Also, there no any classes in this project.

Does this behaviour resemble something that you know?


Thanx for your help guys!

pmmd861
 

RE: Does anyone know what this code is doing?

Would imagine that the other function is called because the worksheet is being re-calculated

that would be why it is called a number of times - probably for each cell that it is dependant on...

Rgds, Geoff

We could learn a lot from crayons. Some are sharp, some are pretty and some are dull. Some have weird names and all are different colours but they all live in the same box.

Please read FAQ222-2244: How to get the best answers before you ask a question

RE: Does anyone know what this code is doing?

(OP)
xlbo, thanx a lot mate!


Exactly, user defined functions in other cells in another sheet! You were right, so simple!

This workbook has 20 sheets and when i got more details about how it works i ve found a row of cells whith the functions which were dependant on the cells that i change.

Thank you guys for your replies.


Best wishes,

pmmd861

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close