Seriously need help

B

Bourbon

I have asked help before about this but no one seems to know the answe
and yet I am sure that it is not that difficult:

Columm A: dates
Columm B: Stock prices
Columm C: Recommendations (ie: there is either B,S,H or TP), there i
only an entry when the recommendation was changed. Thus most of colum
C is empty.
Columm D: Target price. if there is nothing in columm C then there wil
be nothing in columm D.

I chart the columms A and B (I used VBA to do it automatically).
Now here is my query: I want to produce a code that will search colum
C and when ever it finds either a B,S,H or TP, I want it to produce
text box in columm E (I will then copy and paste Columm A, C and D
into that text box......

No one seems to know the way to do this and yet it is the sam
principal as when you run an event study with binomial parameters i
excel (where excel searches for either 0s or 1s) and then executes a
operation.)

Please can anyone help me.........I have attached the excel file. Th
graphic is what it will look like once finished....

Thanks
B

Can you in advanc
 
D

Dave Peterson

Here's an altered version of a response to your previous post:


Option Explicit
Sub testme()

Dim myCell As Range
Dim myRng As Range
Dim myTB As TextBox

With Worksheets("sheet2")

.TextBoxes.Delete 'delete all existing textboxes???

Set myRng = .Range("c1", .Cells(.Rows.Count, "C").End(xlUp))
For Each myCell In myRng.Cells
If InStr(1, ".b.s.h.tp.", "." & LCase(myCell.Value) & ".") = 0 Then
'do nothing
Else
With myCell.Offset(0, 2) 'column E
Set myTB = .Parent.TextBoxes.Add _
(Top:=.Top, Left:=.Left, Width:=.Width, Height:=.Height)
End With
With .Cells(myCell.Row, 1)
myTB.Text = .Text & " " & .Offset(0, 2).Text _
& " " & .Offset(0, 3).Text
End With
End If

Next myCell
End With
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top