Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

another excel vba question Ü

Status
Not open for further replies.

smiley0q0

Technical User
Feb 27, 2001
356
US
Here is my code i have been given to try and replicate a similar report, i beleive i understand most of it, but there are 2 lines that are giving me trouble. the addline and the color.
i know the addline function needs 4 pionts, but the 4 points in this code are variables, and the data changes every day. from this code does it use the actual data in the cells?
and the color where can i find out what color 10 is or 17? if they defined it somewhere i can't find it? is there something i'm missing?


Dim CMSCALLbeginx As Integer
Dim CMSCALLendx As Integer
Dim CMSCALLbeginy As Integer
Dim CMSCALLendy As Integer
Dim CMSCALLvalue As Integer
Dim CMSCALLcolor As Integer


Sheets("ArrowPositioning").Select
CMSCALLbeginx = ActiveSheet.Cells(6, 3).Value
CMSCALLendx = ActiveSheet.Cells(6, 4).Value
CMSCALLbeginy = ActiveSheet.Cells(6, 5).Value
CMSCALLendy = ActiveSheet.Cells(6, 6).Value
CMSCALLvalue = ActiveSheet.Cells(6, 2).Value
CMSCALLcolor = ActiveSheet.Cells(6, 7).Value

Sheets("DashboardSheet").Select

If CMSCALLvalue < 0.5 Then
Sheet1.Shapes.AddLine(CMSCALLbeginx, CMSCALLendx, CMSCALLbeginy, CMSCALLendy).Select
Selection.ShapeRange.Line.Weight = 1.5
Selection.ShapeRange.Line.ForeColor.SchemeColor = CMSCALLcolor
Selection.ShapeRange.Line.EndArrowheadStyle = msoArrowheadTriangle
Selection.ShapeRange.Line.EndArrowheadLength = msoArrowheadLengthMedium
Selection.ShapeRange.Line.EndArrowheadWidth = msoArrowheadWidthMedium
Selection.ShapeRange.Flip msoFlipHorizontal
Selection.ShapeRange.Flip msoFlipVertical
Else
Sheet1.Shapes.AddLine(CMSCALLbeginx, CMSCALLendx, CMSCALLbeginy, CMSCALLendy).Select
Selection.ShapeRange.Line.Weight = 1.5
Selection.ShapeRange.Line.ForeColor.SchemeColor = CMSCALLcolor
Selection.ShapeRange.Line.EndArrowheadStyle = msoArrowheadTriangle
Selection.ShapeRange.Line.EndArrowheadLength = msoArrowheadLengthMedium
Selection.ShapeRange.Line.EndArrowheadWidth = msoArrowheadWidthMedium
Selection.ShapeRange.Flip msoFlipVertical
End If

End Sub
 
For the easy part:

In VB Help..answer wizard...type font.color.index then click color index properties to view the color pallet with values
 
ok, i tried that and got a nice little color palette thing, but the colors there don't match the colors i'm coming up with.
for example... the palette says that 3 is red, but i put in 3 and come up with a greenish color. 10 is red.
i have found the range 0-80 0 being black and 80 being white. i thought it might be the RGB function, but since it only goes up to 80, that throws that out.

any ideas of where i can find what numbers match with what colors?
 
To test if the value is getting through, you could output the results of CMSCALLcolor using a MessageBox.
Code:
MsgBox &quot;The color code received is: &quot; & CMSCALLcolor
Make sure that the value you expect is what's actually there. ----------------------------------------
If you are reading this, then you have read too far... :p

lightwarrior@hotmail.com
 
ok i checked that, and yes, it says the color is whatever is in the cell that CMSCALLcolor is referencing.
but i am looking for a palette or something i can look at that tells me this number is this color.

alos any additional information on the addline function
or where i can get some more info...

Thank you
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top