• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Linking inputs in excel with a macros

Status
Not open for further replies.

Charles T

New Member
Hello All,


Which functions in VBA can I use to link inputs in excel with a macros? I would like to user to be able to input the following parameters:

(1) Number of months in cell C9
(2) Number of employees in cell C10

Based on what the user inputs, I would like excel to automatically add the correct amount of columns and rows to the file. I can I get the macros to understand what has been input into cells C9 and C10?

Please find a copy of the excel file im refering to attached.
 

Attachments

  • Employee_Hours.xlsm
    26.9 KB · Views: 8
Hi Charles,

Let me tell you first, I am no way expert in VBA.
I just downloaded your file for learning purpose.

I may be wrong, but it seems you have recorded the macro & did not get time to edit it.
I will just asume that you are new to VBA, I have tried to edit your code a bit.

There are no changes in the original code, I have just deleted unwanted lines.
There are two new modules in the code now, Version 1 and Clean version.

Version 1 will tell you which lines were not required & new lines.
Clean version will tell you the final code.

Sorry if my assumption of you being new to VBA is wrong. :)

Also, had a doubt, what happens if the user click "Calculate" button multiple times. Would suggest you to seek Ninja's help on this point also.

http://chandoo.org/forum/threads/chandoo-org-ninjas.10830/

P.S. - Please note, I have not checked the working of your code, I have just formatted it.
 

Attachments

  • Employee_Hours(1).xlsm
    30.3 KB · Views: 12
Last edited:
Sanchinbizboy,

Yes, you are correct, I am new to VBA and I don't really understand how your code is working...

I would like to be able to enter in a random number of months and employees into cells C9 and C10. When you press the "calculate" button excel would automatically add the correct number of employees (rows) in the functional resource section, and add the correct number of months (columns) in both the % time devoted to project section and hours/month section.

Which operations can I use to enable excel to do this?

Anybody please help!!!
 
Hi Charles,

If I understand you correctly, you want to create a range with the number of rows based on Employees, and two lots of columns based on Months?

cheers

kanti
 
This topic is the same as last question of this, just 15 hours of difference:
http://chandoo.org/forum/threads/au...lls-when-new-rows-or-columns-are-added.13499/

What you're doing "is called cross-posting and is generally frowned upon in the Blogosphere as it causes people to potentially waste our time when a question is already answered. You should also check and respond to posts and let posters know if they are heading in the write direction or not." Hui's dixit, SIC. And I agree 101%.

If you'd have read the main green sticky post at this forums main page...
http://chandoo.org/forums/topic/phd-forum-posting-rules-etiquette-pls-read-before-posting
...you should have noticed this points:

"Consider that the world is operating 24hrs a day. A late post today may well be answered by someone else overnight."

"If you and a reader have been involved in an ongoing conversation and the conversation suddenly stops, recognize that the person may have gone to bed, even though you have just arrived at work. In the worst case a reader may go on holidays and not get back to the question for a few days."

"Never title your posts as "Urgent", "Priority" "Immediate". It may be Important to you, but not for rest of the members here. These words will be moderated out."

"Cross Posting, generally it is considered poor practice to cross post, that is to post the same question on several forums in the hope of getting a response quicker.
If you do cross post, please put that in your post.
Also if you have cross posted and get an answer elsewhere, have the courtesy of posting the answer here so other readers can learn from the answer also, as well as stopping people wasting there time on your answered question."

"Say "Thanks", whenever you can. Recognize when someone has bothered to go to the trouble and time to assist you with your question for free. Often readers will spend several hours working on a solution to a problem, a line of recognition will go a long way."
 
Status
Not open for further replies.
Back
Top