Frantishek
Цитата:
в каком excel'e? у меня в 2003 работает
может так заработает
[more]
Код: Private Sub Worksheet_SelectionChange(ByVal Target _
As Excel.Range)
Dim s As Shape
Dim width As Integer
Dim color As Long
Dim trans As Single
For Each s In ActiveSheet.Shapes
If Left(s.Name, Len("selection-rect")) = "selection-rect" Then s.Delete
Next
width = 2
color = rgb(255, 0, 0)
trans = 0.8
With ActiveSheet.Shapes.AddShape(msoShapeRectangle, _
ActiveCell.EntireRow.Left, _
ActiveCell.EntireRow.Top, _
ActiveCell.EntireRow.width, _
width)
.Fill.ForeColor.rgb = color
.Fill.Transparency = trans
.Line.Visible = False
.Name = "selection-rect1"
End With
With ActiveSheet.Shapes.AddShape(msoShapeRectangle, _
ActiveCell.EntireRow.Left, _
ActiveCell.EntireRow.Top + ActiveCell.EntireRow.Height - width, _
ActiveCell.EntireRow.width, _
width)
.Fill.ForeColor.rgb = color
.Fill.Transparency = trans
.Line.Visible = False
.Name = "selection-rect2"
End With
With ActiveSheet.Shapes.AddShape(msoShapeRectangle, _
ActiveCell.EntireColumn.Left, _
ActiveCell.EntireColumn.Top, _
width, _
ActiveCell.EntireColumn.Height)
.Fill.ForeColor.rgb = color
.Fill.Transparency = trans
.Line.Visible = False
.Name = "selection-rect3"
End With
With ActiveSheet.Shapes.AddShape(msoShapeRectangle, _
ActiveCell.EntireColumn.Left + ActiveCell.EntireColumn.width - width, _
ActiveCell.EntireColumn.Top, _
width, _
ActiveCell.EntireColumn.Height)
.Fill.ForeColor.rgb = color
.Fill.Transparency = trans
.Line.Visible = False
.Name = "selection-rect4"
End With
End Sub
Цитата:
Ругается на вот это ("указанное значение выходит за допустимые пределы") -
в каком excel'e? у меня в 2003 работает
может так заработает
[more]
Код: Private Sub Worksheet_SelectionChange(ByVal Target _
As Excel.Range)
Dim s As Shape
Dim width As Integer
Dim color As Long
Dim trans As Single
For Each s In ActiveSheet.Shapes
If Left(s.Name, Len("selection-rect")) = "selection-rect" Then s.Delete
Next
width = 2
color = rgb(255, 0, 0)
trans = 0.8
With ActiveSheet.Shapes.AddShape(msoShapeRectangle, _
ActiveCell.EntireRow.Left, _
ActiveCell.EntireRow.Top, _
ActiveCell.EntireRow.width, _
width)
.Fill.ForeColor.rgb = color
.Fill.Transparency = trans
.Line.Visible = False
.Name = "selection-rect1"
End With
With ActiveSheet.Shapes.AddShape(msoShapeRectangle, _
ActiveCell.EntireRow.Left, _
ActiveCell.EntireRow.Top + ActiveCell.EntireRow.Height - width, _
ActiveCell.EntireRow.width, _
width)
.Fill.ForeColor.rgb = color
.Fill.Transparency = trans
.Line.Visible = False
.Name = "selection-rect2"
End With
With ActiveSheet.Shapes.AddShape(msoShapeRectangle, _
ActiveCell.EntireColumn.Left, _
ActiveCell.EntireColumn.Top, _
width, _
ActiveCell.EntireColumn.Height)
.Fill.ForeColor.rgb = color
.Fill.Transparency = trans
.Line.Visible = False
.Name = "selection-rect3"
End With
With ActiveSheet.Shapes.AddShape(msoShapeRectangle, _
ActiveCell.EntireColumn.Left + ActiveCell.EntireColumn.width - width, _
ActiveCell.EntireColumn.Top, _
width, _
ActiveCell.EntireColumn.Height)
.Fill.ForeColor.rgb = color
.Fill.Transparency = trans
.Line.Visible = False
.Name = "selection-rect4"
End With
End Sub