PDA

View Full Version : VBA Code



sosofresh123
12-01-2013, 07:12 PM
I have been assigned a VBA homework assignment, which I have no idea how to write. I barely know basic SQL, and this assignment is due tomorrow morning. In exchange for assistance/solving the problems, I will provide monetary compensation to whoever helps me. The assignment is listed below:

Write the VBA code for the following situations:


1.
An array of
Currency values is called Sales. It contains all of the sales in
a given month. Write the code to calculate the total sales in that month
and the average amount of a sale in that month. Declare all variables
necessary.


2.
There are two arrays of the same size: Customers and Sales. The
Customers array contains Long values, which are the Customer IDs. The
Sales array contains Integer values, and contains the number of sales
made by each of those Customers. Sort the Sales array in order of highest
number of sales to lowest number of sales. Make sure to keep the
Customers array values in the same order, so that the index of a Customer
ID would be the same index used in the Sales array to find their total
sales.


NOTE: You can use whatever sorting algorithm
you wish. If you don’t
know any, you might need to find one online. You can use a separate
array to move the sorted items into temporarily, but then you must copy
the values, in order, back into the Sales and Customers arrays.

Bob Phillips
03-12-2014, 03:18 AM
I am confused, is this an SQL query against a database, or a VBA query against a spreadsheet?

SamT
03-12-2014, 09:03 AM
I think he got an "F" last January

Bob Phillips
03-12-2014, 12:47 PM
Blimey Sam, you are right. He posts the same 'urgent' problem every month. Shall we just throw him into the bin :devil2:

SamT
03-12-2014, 01:15 PM
Nah, He ain't no problem.