View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default Add Selected Items

Dim tot as Long, lngStart as Long
Dim lngEnd as Long, i as Long
tot = 0
lngStart = clng(textbox1.Text)
lngEnd = clng(Textbox2.Text)
for i = 2 to 8
if cells(i,1)= lngStart and cells(i,1)<=lngEnd then _
tot = tot + cells(i,2).Vaue
end if
Next
Textbox3.Text = tot

--
Regards,
Tom Ogilvy


Soniya wrote in message
...
Hi all,


I have Rec_No in my column A and amount in Column B

something like

Rec_No Amount
1 50
2 25
4 35
8 200
10 100
11 15
12 20

I want the user to select From and To rec no and add only
items between those nmbers including start and end no.

If I use a UserForm with Two text boxes users can enter
start receipt and end receipt no. But How can I select
those items only and sum that selection and dispaly the
result in the user form?


TIA
soniya