VBA help (again)

This is a discussion on VBA help (again) within the Trading Software forums, part of the Commercial category; DB, Any comment on the above re direction? Grant....

Reply
 
LinkBack Thread Tools Search this Thread
Old Nov 13, 2007, 5:39pm   #22
Joined Jun 2006
grantx started this thread DB,

Any comment on the above re direction?

Grant.
grantx is offline   Reply With Quote
Old Nov 14, 2007, 12:04pm   #23
 
A Dashing Blade's Avatar
Joined Jul 2004
Apols Grant

Right

The good news is that we now know that changes to N1 or P1 can be captured in the Worksheet_Change event code.

So all you need to do is change the "Application.Statusbar = Target.Value" line (we can, of course, insert as much/little code as we want) to do what you really want to do with these changes. Essentially what's happening is that we can now use the variable "Target" in place of the ExcelDocs(1).Range("P1") stuff we were using previously.

To work out whether Target is N1 or P1 we can use the

If Target.Address = "N1" then

ElseIf Target.Address = "P1" then

End If

(instead of the Appl.statusbar line) structure to further refine the process


Define this as fully as possible and I'll talk you through it.

Last edited by A Dashing Blade; Nov 14, 2007 at 12:11pm.
A Dashing Blade is offline   Reply With Quote
Old Nov 14, 2007, 1:05pm   #24
Joined Jun 2006
grantx started this thread DB,

Please refer to the attachment re code (is it correct?).

I've also included shot of sheet for clarification if needed.

Grant
Attached Files
File Type: doc DB.doc (47.0 KB, 120 views)
grantx is offline   Reply With Quote
Old Nov 14, 2007, 3:16pm   #25
 
A Dashing Blade's Avatar
Joined Jul 2004
Just tested

actually, because the default for the .Address property is the fixed style (ie "$N$1" rather then "N1") tou'll have to use either the syntax

If Target.Address(False, False) = "N1" Then

Elseif Target.Address(False, False) = "P1" Then

End IF


OR

If Target.Address = "$N$1" Then

Elseif Target.Address = "$P$1" Then

End IF


the choice is yours. The (False,False) parameters are obviously saying "don't give me the address property in absolute row and absolute column terms.

Note that, in the above example, your comparing two two sets of text ie the .Address property of a range (which is text) and the text "N1". What you & I call text is what IT bods call a string.
A Dashing Blade is offline   Reply With Quote
Old Nov 15, 2007, 2:16am   #26
Joined Jun 2006
grantx started this thread DB,

Please see attachment, as per instructions. Shouldn't we be specifying a target cell/range?

Grant.
Attached Files
File Type: doc DB 1.doc (25.0 KB, 100 views)
grantx is offline   Reply With Quote
Old Nov 15, 2007, 7:54am   #27
 
A Dashing Blade's Avatar
Joined Jul 2004
Er . .. yes

eg

If Target.Address = "$NS1" then
do something eg Me.Range("A1")=Target.Value will copy N1's value into A1
Else
do something else
End if
A Dashing Blade is offline   Reply With Quote
Old Nov 15, 2007, 6:28pm   #28
Joined Jun 2006
grantx started this thread DB,

It's a fair cop. Ignorance may be a defence but stupidity doesn't stand up.

Still isn't working, I'm afraid.

I don't like to burden you with all my queries so I spread them across various sites. And there is a recurring feature of most solutions - they don't work. I don't believe this is due to faults in the codes but a possible conflict with VBA code/modules from my data vendor. This is just a guess - based on either ignorance or stupidity.

For example, the the data in Excel sheet I've attached on a number of occasions has its origins from a VBA charting module here (please refer to the attachment).

The bottom chart is the focus (albeit blank). Once attached to the price (tick) chart data is downloaded into Excel. The code been expanded to include more fields, for example.

What do you reckon?

Grant.
grantx is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Similar Threads
Thread Thread Starter Forum Replies Last Post
Pivots and VBA grantx Technical Analysis 7 Nov 1, 2007 10:40pm
VBA help needed grantx Technical Analysis 24 Oct 19, 2007 8:10pm
Excel VBA Developer job??? gurm Home Trader 7 Nov 30, 2005 9:29pm
any techies able to help Excel Vba V. III Techies Corner 3 Sep 19, 2003 9:51am

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)