Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default VB code to total up a column as the value change on a nother

Hello Everyone,

I got a Excel tabel like below.
I want to write a code to Total up some figures.
Every Change in Date (Column A), Flight No (Column B), Out/In(Column
D), Column H's figures should total up to "Column I" as it shown in
the example above.
Like wise Column J's figures should total up to Column K.
As user add records i want it to automaticaly update Column I and
Column K.
I want to keep Colum I and Column K locked.



A B D H I J K
Date Flight Out/ Total Total Return Return
No. In Per Per Per Per
Series Flight Series Flight

10.01.05 878 Out 6 2
10.01.05 878 Out 10 16 3 5
10.01.05 878 In 15 5
10.01.05 878 In 10 4
10.01.05 878 In 10 35 9 18
10.01.05 578 Out 15 5
10.01.05 578 Out 12 27 3 8
10.01.05 578 In 20 6
10.01.05 578 In 20 40 4 10
11.01.05 878 Out 6 2
11.01.05 878 Out 10 16 3 5
11.01.05 878 In 10 4
11.01.05 878 In 10 20 9 13
11.01.05 578 Out 15 5
11.01.05 578 Out 12 27 3 8
11.01.05 578 In 20 6
11.01.05 578 In 20 40 4 10




Is there a way to do this in VB coding?

A help will be really appriciated.

Thank you very much in advance.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default VB code to total up a column as the value change on a nother

Where does the first line of data start? What Row?

10.01.05 878 Out 6 2

What row would that be in?

--
Regards,
Tom Ogilvy


"Fernando" wrote in message
om...
Hello Everyone,

I got a Excel tabel like below.
I want to write a code to Total up some figures.
Every Change in Date (Column A), Flight No (Column B), Out/In(Column
D), Column H's figures should total up to "Column I" as it shown in
the example above.
Like wise Column J's figures should total up to Column K.
As user add records i want it to automaticaly update Column I and
Column K.
I want to keep Colum I and Column K locked.



A B D H I J K
Date Flight Out/ Total Total Return Return
No. In Per Per Per Per
Series Flight Series Flight

10.01.05 878 Out 6 2
10.01.05 878 Out 10 16 3 5
10.01.05 878 In 15 5
10.01.05 878 In 10 4
10.01.05 878 In 10 35 9 18
10.01.05 578 Out 15 5
10.01.05 578 Out 12 27 3 8
10.01.05 578 In 20 6
10.01.05 578 In 20 40 4 10
11.01.05 878 Out 6 2
11.01.05 878 Out 10 16 3 5
11.01.05 878 In 10 4
11.01.05 878 In 10 20 9 13
11.01.05 578 Out 15 5
11.01.05 578 Out 12 27 3 8
11.01.05 578 In 20 6
11.01.05 578 In 20 40 4 10




Is there a way to do this in VB coding?

A help will be really appriciated.

Thank you very much in advance.



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default VB code to total up a column as the value change on a nother

Hello Mr Ogivy,

Sorry earlier I cut and past it from words, now i type the whole table
again I guess now its readable.

I'll repeat the q.

I want to write a code to Total up some figures.
Every Change in Date (Column A), Flight No (Column B), Out/In(Column D),
Column H’s figures should total up to "Column I" as it shown in the
example above.
Like wise Column J’s figures should total up to Column K.
As user add records i want it to automaticaly update Column I and Column
K.


A B D H I J K
Date Flight Out/ Total Total Return Return
No In per per per per
series flight series flight

10.01.05 878 out 6 2
10.01.05 878 out 10 16 3 5
10.01.05 878 in 15 5
10.01.05 878 in 10 4
10.01.05 878 in 10 35 9 18
10.01.05 578 out 15 5
10.01.05 578 out 12 27 3 8
10.01.05 578 in 20 6
10.01.05 578 in 20 40 4 10
11.01.05 878 out 6 2
11.01.05 878 out 10 16 3 5
11.01.05 878 in 10 4
11.01.05 878 in 10 20 9 13
11.01.05 578 out 15 5
11.01.05 578 out 12 27 3 8
11.01.05 578 in 20 6
11.01.05 578 in 20 40 4 10

Remember it's the same sheet that you write this code.


Private Sub Worksheet_Change(ByVal Target As Excel.Range)
Dim rng As Range, cell As Range, bFound As Boolean
ActiveSheet.Unprotect
If Target.Count 1 Then Exit Sub
If Target.Address = "$G$2" Then
Cells.Interior.ColorIndex = xlNone
'To select the whole column of the "Seals From"
Set rng = Range(Cells(5, 6), Cells(Rows.Count, 6).End(xlUp))
bFound = False
For Each cell In rng
If cell.Value <= Target And cell.Offset(0, 1).Value = Target.Value
Then
If Not bFound Then
Cells(cell.Row, "J").Select
bFound = True
End If
cell.EntireRow.Interior.ColorIndex = 6
End If
Next
End If
ActiveSheet.Protect

End Sub



*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
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
Code to change column height of arrays? tskogstrom Excel Discussion (Misc queries) 0 March 7th 07 06:02 PM
DIVIDING TOTAL CELLS IN COLUMN BY 16 TRYING TO CHANGE WEIGHT OZ TO HYDROPONICSUSA Excel Worksheet Functions 2 December 11th 06 02:06 PM
Link the formate from one cell to a nother in diffrent sheet Markus Excel Worksheet Functions 1 February 2nd 05 01:50 PM
Total up a column on change of another Fernando[_2_] Excel Programming 0 January 23rd 05 04:59 PM
Change Word Total and Grand Total Indu Aronson Excel Programming 2 February 16th 04 07:02 PM


All times are GMT +1. The time now is 07:56 AM.

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"