Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 3
Default is this not working because i am using 03?

Hi all

Borrowed a friends code to move some cells when you click a live button and
then on a crytalise button. The 'live' button changes colour when you are
ready and clicking the crystalise button should reset the colour and move a
row of numbers into another spreadsheet.
keep tripping up on the following;
If liveButton.Fill.ForeColor.SchemeColor = 13 Then

Anyone have any ideas? I've included the whole code below;

im thisShape As Shape
Set thisShape = ActiveSheet.Shapes(Application.Caller)
Dim r As Range
Set r = thisShape.TopLeftCell
'check that this is a row that we have made live
Dim liveButton As Shape
For Each liveButton In ActiveSheet.Shapes
If liveButton.TopLeftCell.Row = r.Row And
liveButton.TopLeftCell.Column = 14 Then
GoTo checkColour
End If
Next liveButton
checkColour:
If liveButton.Fill.ForeColor.SchemeColor = 13 Then
Exit Sub
End If

'check that we have all the required entries
If Not (checkCellValue(Cells(r.Row, 6), "Stop/Exit $")) Then
Exit Sub
End If

'find the pnl row
Dim firstCellInPnLRow As Range
Set firstCellInPnLRow = Cells(25, 5)
While firstCellInPnLRow.Value < Cells(r.Row, 5).Value
Set firstCellInPnLRow = firstCellInPnLRow.Offset(1, 0)
If (firstCellInPnLRow.Value = "") Then
MsgBox ("Can't find entry in PnL table for this instrument")
Exit Sub
End If
Wend

'find the trade log entry for this row
Dim logSheet As Worksheet
Set logSheet = ActiveWorkbook.Sheets("Trade Log")
Dim firstCellInRow As Range
Set firstCellInRow = logSheet.Cells(2, 1)
Dim found As Boolean
found = False
While firstCellInRow.Value < ""
If firstCellInRow.Value = Cells(r.Row, 17).Value Then
found = True
GoTo after
End If
Set firstCellInRow = firstCellInRow.Offset(1, 0)
Wend
after:
If found = False Then
MsgBox "Can't find log entry for this row"
Exit Sub
End If

'update the trade log entry
firstCellInRow.Offset(0, 2).Value = Date
firstCellInRow.Offset(0, 7).Value = Cells(r.Row, 10)

'update the pnl
firstCellInPnLRow.Offset(0, 1).Value = firstCellInPnLRow.Offset(0,
1).Value + Cells(r.Row, 6).Value

'look up the fx rate
Dim cur As String
cur = firstCellInRow.Offset(0, 12).Value
Set logSheet = ActiveWorkbook.Sheets("Reference Data")
Dim referenceTableRow As Range
Set referenceTableRow = logSheet.Cells(3, 12)
While (Not referenceTableRow.Value = "" And Not referenceTableRow.Value
= cur)
Set referenceTableRow = referenceTableRow.Offset(1, 0)
Wend
If (referenceTableRow.Value = "" Or referenceTableRow.Offset(0, 1).Value
= "") Then
MsgBox "Can't find fxrate for " + cur
End If
firstCellInRow.Offset(0, 13) = referenceTableRow.Offset(0, 1).Value

'clear the row ready for a new trade
Call clear

End Sub


I am trying to run this on excel 03 and I'm not sure what this was written
on -would that make a difference?

If anyone has any thoughts I would be most grateful!!!


  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 2,420
Default is this not working because i am using 03?

I think it is dropping into that code after it has processed all buttons,
therefore trying to get the properties of a null object. The Goto code you
have in this proc is very badly written, jumping out of a loop, and then you
do it again later on.

I think the whole routine needs a re-write.

--
__________________________________
HTH

Bob

"out of my depth" wrote in message
...
Hi all

Borrowed a friends code to move some cells when you click a live button
and
then on a crytalise button. The 'live' button changes colour when you are
ready and clicking the crystalise button should reset the colour and move
a
row of numbers into another spreadsheet.
keep tripping up on the following;
If liveButton.Fill.ForeColor.SchemeColor = 13 Then

Anyone have any ideas? I've included the whole code below;

im thisShape As Shape
Set thisShape = ActiveSheet.Shapes(Application.Caller)
Dim r As Range
Set r = thisShape.TopLeftCell
'check that this is a row that we have made live
Dim liveButton As Shape
For Each liveButton In ActiveSheet.Shapes
If liveButton.TopLeftCell.Row = r.Row And
liveButton.TopLeftCell.Column = 14 Then
GoTo checkColour
End If
Next liveButton
checkColour:
If liveButton.Fill.ForeColor.SchemeColor = 13 Then
Exit Sub
End If

'check that we have all the required entries
If Not (checkCellValue(Cells(r.Row, 6), "Stop/Exit $")) Then
Exit Sub
End If

'find the pnl row
Dim firstCellInPnLRow As Range
Set firstCellInPnLRow = Cells(25, 5)
While firstCellInPnLRow.Value < Cells(r.Row, 5).Value
Set firstCellInPnLRow = firstCellInPnLRow.Offset(1, 0)
If (firstCellInPnLRow.Value = "") Then
MsgBox ("Can't find entry in PnL table for this instrument")
Exit Sub
End If
Wend

'find the trade log entry for this row
Dim logSheet As Worksheet
Set logSheet = ActiveWorkbook.Sheets("Trade Log")
Dim firstCellInRow As Range
Set firstCellInRow = logSheet.Cells(2, 1)
Dim found As Boolean
found = False
While firstCellInRow.Value < ""
If firstCellInRow.Value = Cells(r.Row, 17).Value Then
found = True
GoTo after
End If
Set firstCellInRow = firstCellInRow.Offset(1, 0)
Wend
after:
If found = False Then
MsgBox "Can't find log entry for this row"
Exit Sub
End If

'update the trade log entry
firstCellInRow.Offset(0, 2).Value = Date
firstCellInRow.Offset(0, 7).Value = Cells(r.Row, 10)

'update the pnl
firstCellInPnLRow.Offset(0, 1).Value = firstCellInPnLRow.Offset(0,
1).Value + Cells(r.Row, 6).Value

'look up the fx rate
Dim cur As String
cur = firstCellInRow.Offset(0, 12).Value
Set logSheet = ActiveWorkbook.Sheets("Reference Data")
Dim referenceTableRow As Range
Set referenceTableRow = logSheet.Cells(3, 12)
While (Not referenceTableRow.Value = "" And Not referenceTableRow.Value
= cur)
Set referenceTableRow = referenceTableRow.Offset(1, 0)
Wend
If (referenceTableRow.Value = "" Or referenceTableRow.Offset(0,
1).Value
= "") Then
MsgBox "Can't find fxrate for " + cur
End If
firstCellInRow.Offset(0, 13) = referenceTableRow.Offset(0, 1).Value

'clear the row ready for a new trade
Call clear

End Sub


I am trying to run this on excel 03 and I'm not sure what this was written
on -would that make a difference?

If anyone has any thoughts I would be most grateful!!!




Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Calculate working days but change working week SamB Excel Discussion (Misc queries) 1 September 1st 08 09:17 PM
Making weekend days working days - the system cuts the working tim Fluffy Excel Discussion (Misc queries) 1 May 30th 08 10:02 PM
ZERO VALUE NOT WORKING Gator Girl Excel Discussion (Misc queries) 2 August 29th 07 07:06 PM
Add-ins not working [email protected] Links and Linking in Excel 2 March 20th 07 03:20 AM
Sum(if not working Beverly C Excel Discussion (Misc queries) 5 February 6th 07 02:10 PM


All times are GMT +1. The time now is 01:19 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"