Thread: How to branch?
View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
achidsey achidsey is offline
external usenet poster
 
Posts: 100
Default How to branch?

Excel Experts:

My VBA skills allow me to delete columns, add numbers and such, but I don't
know how to structure code to take different actions based on conditions.

My spreadsheet is similar to the following:

A B C
1 Existing Positions:
2 AMD 50
3 DELL 75
4 MSFT 100
5 New Trades:
6 Type Symbol Shares
7 ADD AMD 25
8 SELLPARTIAL DELL 50
9 SELLALL MSFT 100

I want my program to take a different action on an Existing Position, based
on the Type of the New Trade. For the new trade in AMD, Type ADD, I want to
add the 25 new shares to the existing 50 shares. For DELL, type SELLPARTIAL,
I want to reduce the exising shares by 50. For MSFT, type SELLALL, I want to
move the existing position to a different part of my spreadsheet.

I think I want to use a Select Case structure, as I have 8 different Types.

How would I structure the code?

Thanks,
Alan

--
achidsey