Help With Visual Basic Program For Excel

I am having trouble designing a program with VBA for Microsoft Excel. I have one column of a list with company’s that are labeled “long positions”. I have another column where company’s that are labeled “short positions”. This is for my investments with the stock market. In rows, I list if a company changes from long to short from one day to the next day, short to long from one day to the next day, stays long from one day to the next day, or stays short from one day to the next day (this is programmed already and done automatically). The problem is, if a company changes, for example from a long to short from day 1 to 2, 3 to 4, etcetera, the initial column list needs to be manually updated (for example, if company A changes from a long to a short from day 15th to 16th, done automatically, I would have to change company A from the long list to a short list. This takes a long time and I’d rather have a program that can do it. I tried to create a macro but keep failing. Can anyone please help me?

 

pseudocode 

if(long stays long or short stays short for company i){

null; //do not change change anything

}

if(long becomes short for company i from day j to k, consecutive days,){

long=short; //change long to short in other list

}

if(short becomes long for company i from day j to k, consecutive days,){

short=long; //change short to long in other list

}

By: joe smith

Leave a Reply

Your email address will not be published. Required fields are marked *