LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 100
Default Select Case

I am trying to us a Select Case Construction but I am not able to get the
program to choose the branch.

I have a spreadsheet similar to the following:
A B C D
E
1 Old
2 Symbol Shares TotalShares
3 AMD 50
4
5 - New Trade -
6 Trade Type Symbol New Shares
7 ADD AMD 25
8

I want my code to put a value in cell below "TotalShares" (D3) based on the
entry in the cell below Trade Type (A7).

If the Trade Type is:
"ADD", add New Shares to Old Shares.
"SELLPARTIAL", subtract New Shares from Old Shares
"SELLALL", subtract New Shares from Old Shares and enter "sold" in E3

Here is my code.
My problem is that I want it to execute the statements below Case Add but it
skips over that code. I don't know how to indicate that this is Case ADD.

How to I fix this? Thanks, Alan


Sub ProcessTrades()

Dim TrType As Range
Dim OldShares As Range
Dim TradeShares As Range
Dim TotalShares As Range

Set OldShares = Range("C3")
Set TradeShares = Range("C7")
Set TotalShares = Range("D3")
Set TrType = Range("A7")

Select Case TrType

Case Add
TotalShares.Value = OldShares.Value + TradeShares.Value

Case SellPartial
TotalShares.Value = OldShares.Value - TradeShares.Value

Case SellAll
TotalShares.Value = OldShares.Value - TradeShares.Value
Range(E3).Value = "sold"

End Select
End Sub


achidsey
 
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
select case Hein Excel Discussion (Misc queries) 5 November 24th 09 01:19 PM
Case without Select Case error problem Ayo Excel Discussion (Misc queries) 2 May 16th 08 03:48 PM
Select Case Jeff Excel Discussion (Misc queries) 1 February 27th 06 02:56 PM
Case Select Kelly Excel Programming 6 March 16th 05 01:29 PM
For Each with Select Case helmekki[_28_] Excel Programming 2 October 15th 04 03:23 AM


All times are GMT +1. The time now is 02:54 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"