Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

create column to denote leg#

Posted on 2011-03-10
7
Medium Priority
?
268 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 2000 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
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 

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

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

Some code to ensure data integrity when using macros within Excel. Also included code that helps secure your data within an Excel workbook.
This article describes how to use a set of graphical playing cards to create a Draw Poker game in Excel or VB6.
The viewer will learn how to use the =DISCRINV command to create a discrete random variable, use this command to model a set of probabilities and outcomes in a Monte Carlo simulation, and learn how to find the standard deviation of a set of probabil…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

722 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