Keith_H
08-17-2004, 06:22 AM
Hi there,
I've developed a very basic script in Excel. (It selects a small range, and for each cell, it changes the background colour based upon what is typed in the cell, red for R, yellow for Y, green for G, otherwise blank).
I can't get a similar script to work for a 1-2-3 spreadsheet, though. Can anybody point out where I'm going wrong. (I know that the 1-2-3 script language is not 100% common with VBA as used in Microsoft Excel).
Your help will be appreciated. Thanks.
Keith
:dunno
Excel script:
Sub Part1()
Range ("O9:Y56").Select
End Sub
Sub Part2
For Each cell In Selection
If cell.value = "R" Then
cell.Interior.ColorIndex = 3
If cell.value = "Y" Then
cell.Interior.ColorIndex = 6
If cell.value = "G" Then
cell.Interior.ColorIndex = 4
1-2-3 script
error: not a collection object
Sub test01
[Overview Region:O9..Overview Region:Y56].Select
Forall dave In Selection
If dave = "G" Then
Selection.Background.Backcolor.Colorname = "leaf green"
Elseif dave = "Y" Then
Selection.Background.Backcolor.Colorname = "yellow"
Elseif dave = "R" Then
Selection.Background.Backcolor.Colorname = "light salmon"
End If
End Forall
End Sub
I've developed a very basic script in Excel. (It selects a small range, and for each cell, it changes the background colour based upon what is typed in the cell, red for R, yellow for Y, green for G, otherwise blank).
I can't get a similar script to work for a 1-2-3 spreadsheet, though. Can anybody point out where I'm going wrong. (I know that the 1-2-3 script language is not 100% common with VBA as used in Microsoft Excel).
Your help will be appreciated. Thanks.
Keith
:dunno
Excel script:
Sub Part1()
Range ("O9:Y56").Select
End Sub
Sub Part2
For Each cell In Selection
If cell.value = "R" Then
cell.Interior.ColorIndex = 3
If cell.value = "Y" Then
cell.Interior.ColorIndex = 6
If cell.value = "G" Then
cell.Interior.ColorIndex = 4
1-2-3 script
error: not a collection object
Sub test01
[Overview Region:O9..Overview Region:Y56].Select
Forall dave In Selection
If dave = "G" Then
Selection.Background.Backcolor.Colorname = "leaf green"
Elseif dave = "Y" Then
Selection.Background.Backcolor.Colorname = "yellow"
Elseif dave = "R" Then
Selection.Background.Backcolor.Colorname = "light salmon"
End If
End Forall
End Sub