Cool Excel VBA code, any ideas? [excel vba code]

Q: What are some cool aspects that I can use some VBA code to execute? In one of my classes that I use Excel, the teacher has a contest among students and who has the best project will be a letter grade increase (B to A) get any cool ideas I can incorporate into my VBA code?


Best Answer: I infer that you want to insert the rows above row 2, moving the date in A2 down the number of rows specified by the macro.

As it stands your DateDiff function is going to result in a negative number, because the 'x' and 'y' values are reversed in the code line. You are subtracting 'today' from the date in A2.

When selecting rows using a variable you would have to structure your line 8 as:

Rows(z & ":" & 2).Select

The following would be the modified code:

Option Explicit

Sub Insert_Rows()

Dim x As Date
Dim y As Long
Dim z As Long

x = Date
y = Sheets("Sheet1").Cells(2, 1).Value
z = DateDiff("d", y, x) + 2

Rows(z & ":" & 2).Select
Selection.Insert Shift:=xlDown, CopyOrigin:=xlFormatFromLeftOrAbove
End Sub

VBA refers to Visual Basic for Applictions. This is the built Visual Basic designed/modified to be used with the MS Office suite.


A Tutorial on Vba for Excel
Re:if it is a linear program, why not code up your own simplex algorithm. You can have some "cool" diagnostic data spit out as your "optimizer" is plugging away (ie, what pivots are taken).

Excel Vba Made Easy and Visual Basic 6 Made Easy
Re:although I can't help, you may want to go to http://www.mrexcel.com/board2/ and search or ask.

de


Advanced Excel Profit Center Shop.
Re:ok, this is what I have to do:

I have a linear programming model in which three different auditors, John, Bill, and Michelle will be chosen for certain projects. certain constraints you will be able to change, like their salary for projects 1,2, and 3 as well as the available hours they have to work and required hours for each project.

One userform or multiple userforms will take these values using Excel solver and find the optimal solution which will maximize profits, here (http://www.linuxownz.com/excel.xls) is what I have so far. Let me know what you think.

I have pictures of three of my professors that I want to display in the middle of the form. Whenever I click the button on the left corresponding to their name and click their picture, a box will come up to input for me to change their parameters (salary for project 1, salary for project 2, salary for project 3, and hours available to work)

I have a class competition for a grade boost for this, any ideas would help me out. He doesnt care if we get help or what outside code we uses, he just said give em' hell. Competition seems to be somewhat fierce. Please help or point me in a direction that may help me more. Thanks!

I can add graphs, images, whatever. marketing is the most important aspect of the project since the class votes on it. So whatever pizzazz you can suggest would be great. thanks.


Singing Excellence
Re:I don't know what your project is and your question is way to vague for a useful answer. but why don't you try connecting your excel app to a database in access (using ADO or somesuch). Or you could have excel trigger a mass mail merge from outlook (or send some sort of "confirmation" email or "error" email through outlook).

The PPC Code
Re:How about your very own word virus? :)

Excel Expert User-Your One Stop Solution In Mastering Microsoft Excel
Re:If Windows Scripting Host is installed on the computers, and antivirus protection is not, you could always write some code to execute a script that [use your imagination here, the possibilities are endless].

Not sure what kind of options VBA gives you for entertaining activities. :D


The Manifestation Code
Re:I don't know if this is exactly what your talking about, but you could download "Microsoft Agents." They are little characters that can be coded to respond to VBA commands. You would have to install some programs to make them work first.

Here are a few sites that I found randomly with Google. It is NOT hard to learn, and I'm sure I could help you with some of it if you wanted.

Click Me (http://construction.ntu.ac.uk/mle/Agents.htm)
Click Me (PDF File) (http://construction.ntu.ac.uk/mle/Agent%20Files/Agents%20with%20PowerPoint.pdf)

Basically, you would have to install the characters, and their speech engines. Then the animation, and making them talk is REALLY easy. This would definitely be "cool" to incorporate for some project like this.

guy


Related posts

Leave a comment

0 Comments.

Leave a Reply


click to changeSecurity Code

[ Ctrl + Enter ]