Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Ian
 
Posts: n/a
Default

Go to ToolsMacroMacros... and enter Total_Expenditures (or another name,
without spaces) as the name, then click Create. Copy and paste all but the
first and last lines of my code (they are already there). Close the Visual
Basic window.

I notice in the message below that some of the lines have wrapped. I have
marked the beginning of each line of code with a *. Anything in between
belongs on the line before.

To run the macro, go to ToolsMacroMacros..., highlight the macro name and
click run.

--
Ian
--
"Alylia" wrote in message
...
Please can I be guided as to how I should create the macro i.e. what
should I
do with the syntax below.

"Ian" wrote:

Try this macro. I've made some assumptions, as below
Assuming you have more than 1 line of monthly totals for different
products/departments.
Assuming monthly data starts in row 2
Assuming monthly data is in columns 1 to 12 (A to L)
Assuming Current total is in column 13 (M)

* Private Sub Total_Expenditures()
* For r = 2 To 20 ' First row of data to last row of data
* If Cells(r, 1).Value = "" Then ' If data cell in column A is blank
* Cells(r, 13).Value = "" ' Make column M blank
* GoTo subend ' Go to end of macro
* End If
* For c = 1 To 12 ' For columns A to L (12 months)
* If Cells(r, c).Value = "" Then GoTo continue ' If column cell is blank,
continue with calculation

* Next c ' Otherwise try the next column
* continue:
* c = c - 1 ' Move back one column from the first blank
* Cells(r, 13).Value = Cells(r, c) ' Make colum M equal to last column
with
value

* subend:
* Next r ' Start on the next row of data
* End Sub

--
Ian
--
"Alylia" wrote in message
...
Thank you for your support

The expenditures are year to date, but there is a potential problem
with
what you have suggested.

The total expenditure including funds which have been committed and
which
may be liquidated or cancelled at a later date, as a result the total
expenditure for say 31 August may be higher than that of 30 September
as
some
funds might have been liquidated in September. The formula should pick
out
the total expenditure as at 30 September and not the maximum as you
have
suggested.

Thx once again

"Ian" wrote:

Are the values in the columns monthly expenditure or year to date?

Assuming monthly expenditure you would simply need to add the monthly
values
together with something like =SUM(A2:C2).
If each is a year to date total, then you just need to find the
maximum
value from the columns with somethign like =MAX(A2:C2). If the values
are
entered as negative numbers replace MAX with MIN.

--
Ian
--
"Alylia" wrote in message
...
Hello,

I have columns of data into which entry should be made at different
time
intervals.

An example of the field format is given below:

Expenditure Expenditure Expenditure
as at 31/8 as at 30/9 as at 31/10


The cumulative expenditures as at the given dates would have to be
entered
under the various coulmns and I would like assistance on which
syntax/formula
I should use in a field called "Total Expenditures" to get the
latest
data
from the columns of data.

Thx








Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Charting data points and show a target range on the same chart. Minireefkeeper Charts and Charting in Excel 6 February 18th 06 06:50 PM
SELECT large amount of data in a worksheet OTS Excel Discussion (Misc queries) 3 August 13th 05 04:43 PM
Data in table, may need to convert to columns with OFFSET? Ron H Excel Discussion (Misc queries) 5 July 31st 05 06:44 PM
Pulling data from 1 sheet to another Dave1155 Excel Worksheet Functions 1 January 12th 05 05:55 PM
How can I check if data in an external data range is changed afte. Ruud Excel Worksheet Functions 0 January 7th 05 12:15 PM


All times are GMT +1. The time now is 04:56 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"