help with a variable


Posted by steve on February 16, 2001 9:33 PM

Can anyone help me make the freeform number in this code a variable so I don't have to modify this code to change the number. I would like to be able to input the number from the workbook like you do with other excel functions.

thanks steve

Function FILLCOLOR(S1, S2) As Single

Select Case S1
Case "T"
With Sheet1.Shapes("freeform 1")
.Fill.ForeColor.SchemeColor = 5
End With
Case "W"
With Sheet1.Shapes("freeform 1")
.Fill.ForeColor.SchemeColor = 20
End With
Case "V"
With Sheet1.Shapes("freeform 1")
.Fill.ForeColor.SchemeColor = 40
End With
Case "SV"
With Sheet1.Shapes("freeform 1")
.Fill.ForeColor.SchemeColor = 30
End With
Case "C"
With Sheet1.Shapes("freeform 1")
.Fill.ForeColor.SchemeColor = 22
End With
Case "L"
With Sheet1.Shapes("freeform 1")
.Fill.ForeColor.SchemeColor = 33
End With
End Select

Select Case S2

Case "T"
With Sheet1.Shapes("FREEFORM 2")
.Fill.ForeColor.SchemeColor = 5
End With
Case "W"
With Sheet1.Shapes("FREEFORM 2")
.Fill.ForeColor.SchemeColor = 20
End With
Case "V"
With Sheet1.Shapes("FREEFORM 2")
.Fill.ForeColor.SchemeColor = 40
End With
Case "SV"
With Sheet1.Shapes("FREEFORM 2")
.Fill.ForeColor.SchemeColor = 30
End With
Case "C"
With Sheet1.Shapes("FREEFORM 2")
.Fill.ForeColor.SchemeColor = 22
End With
Case "L"
With Sheet1.Shapes("FREEFORM 2")
.Fill.ForeColor.SchemeColor = 33
End With
End Select

End Function



Posted by Dave Hawley on February 17, 2001 1:03 AM

Steve, try this

Dim i As Integer

i = Sheets("Sheet1").Range("A1")

With Sheet1.Shapes("freeform " & i)

Dave

OzGrid Business Applications