Conditional

  • Thread starter Thread starter ksnapp
  • Start date Start date
K

ksnapp

Hello,

I have a column that countains fee discriptions and every now and then
a total fees cell. In the next row to the right I have the amount of
those fees and a blank cell next to the total cell. I need to put a
total in that blank cell that is the total of about 1/2 dozen different
kinds of fees, but not all of the fees that are on the sheet.

Can this be done w/ a sub? Does anybody have an example for me?
 
Hi
not quite sure what you're trying to achieve. You may post some example
rows (plain text, no attachments please) and describe your desired
result
 
Fee Discription $

total fee
ticket 10
light 50
transit 10
total fee

lets say i need to fill the cells to the lft of the "Total fee" cel
with the sum of ticket and transit fees.

one million thank you
 
Hi
should the result in 'total fee' be dynamic or is it sufficient to run
a macro ones and insert the values? If yes try the following:
- select you cells which you want to process (thats is in your example
column B):
- start the following macro

sub total_insert()
dim rng as range
dim cell as range
dim ret_value
set rng = selection
ret_value=0
for each cell in rng
if cell.offset(0,-1).value="total fee" then
cell.value= ret_value
ret_value = 0
elseif cell.offset(0,-1).value = "ticket" or
cell.offset(0,-1).value = "transit" then
ret_value = ret_value + cell.value
end if
next
end sub
 
Back
Top