Solved

create column to denote leg#

Posted on 2011-03-10
7
265 Views
Last Modified: 2012-05-11
I need a macro that will make a new output tab with a new column for the trade history section of the original tabs (pm or rm).  Each row is considered a leg.  I need the new column to denote a number for each leg of any spread type and start over with the next symbol.  An example of what this might look like is shown here in the third column >> http://screencast.com/t/WF0hnvqi8pon

Note that the third column is not there by default and is created based on the spread.  If it is a multi-legged spread, the column shows the number of legs.  If it is a single-legged spread, it only shows one leg.
trade-macro-v2.1c.xlsm
0
Comment
Question by:rtod2
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
7 Comments
 
LVL 22

Expert Comment

by:rspahitz
ID: 35110145
Could you use a formula instead?  Something like this? (starting in cell C2)


=IF(AND(B2<>"",B2<>0),"Leg1","Leg"&IF(C1="",1,(VALUE(MID(C1&"   0",4,3))+1)))
0
 

Author Comment

by:rtod2
ID: 35110292
That certainly doesn't create an output tab.  Macro still needed.
0
 
LVL 22

Accepted Solution

by:
rspahitz earned 500 total points
ID: 35110381
sorry, I guess I don't understand your request.
if you create a new tab on the workbook, what do you want in it?

VBA code to create a new tab:

Sub AddOutputSheet()
    Sheets.Add After:=Sheets(Sheets.Count)
    Sheets(Sheets.Count).Name = "Output"
End Sub
0
MS Dynamics Made Instantly Simpler

Make Your Microsoft Dynamics Investment Count  & Drastically Decrease Training Time by Providing Intuitive Step-By-Step WalkThru Tutorials.

 

Author Comment

by:rtod2
ID: 35110545
Ah, ok
Yeah I was wanting it to extract the trade history section and add a new row to the trade history.
0
 
LVL 22

Expert Comment

by:rspahitz
ID: 35110627
so you're looking to create a new tab called "rm output" that does the same thing that pm output does?
At this point, I don't see the correlation between pm and pm-output so I wouldn't know how to make the rm output's data.

It seems you may need to break this down into smaller tasks (possibly with separate questions) such as:
1) search through the rm sheet looking for TYPE TRD in column C and place the corresponding value into a new tab called rm output
2) add a new column C in rm output called leg and populate it with "LEG" followed by a number there the number starts at 1 and increases by 1 every time the corresponding value in column B is blank

etc.
0
 

Author Comment

by:rtod2
ID: 35110663
Yeah, just looking for it to extrapolate that section from either pm or rm and create the new column.
0
 

Author Comment

by:rtod2
ID: 35111424
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Excel can be a tricky bit of software to get your head around. Whilst you’ll be able to eventually get to grips with the basic understanding of how to get by, there are a few Excel tips that not everybody will even know about let alone know how to d…
Access developers frequently have requirements to interact with Excel (import from or output to) in their applications.  You might be able to accomplish this with the TransferSpreadsheet and OutputTo methods, but in this series of articles I will di…
This Micro Tutorial demonstrate the bugs in Microsoft Excel for Mac with Pivot Charts.
Many functions in Excel can make decisions. The most simple of these is the IF function: it returns a value depending on whether a condition you describe is true or false. Once you get the hang of using the IF function, you will find it easier to us…

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question