Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 48
Default Add Selected Items

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

  #2   Report Post  
Posted to microsoft.public.excel.programming
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



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
Copying only selected items to another worksheet firewaterjoe Excel Worksheet Functions 1 January 23rd 08 06:12 PM
Items, when selected doesn't appear!? Pivot Table Question? Items Excel Discussion (Misc queries) 1 October 28th 05 09:31 PM
named range, data validation: list non-selected items, and new added items KR Excel Discussion (Misc queries) 1 June 24th 05 05:21 AM
Is it possible to copy only selected items to another worksheet... HEATHERCOX Excel Worksheet Functions 2 March 1st 05 01:21 PM
selected items flash Johan Tufvander Excel Discussion (Misc queries) 2 February 17th 05 01:13 PM


All times are GMT +1. The time now is 11:27 AM.

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

About Us

"It's about Microsoft Excel"