"T" <myicqKATTE@bakkegmx.net> skrev i en meddelelse
news:Xns996872CA93F5CmyicqKATTEbakkegmxne@62.243.74.162...
> Når man arbejder på et stort regneark i høj opløsning, er det så muligt at
> farvelægge / tone aktuel række / kolonne - altså ikke en blivende farve,
> men bare når cursoren bevæges rundt. Jeg ved godt række/ kolonnenummer
> vises farvet, men det kan være svært at "ramme" ud for andre tal/felter.
>
> Jeg har set en løsning her :
>
>
http://www.mcgimpsey.com/excel/highlightrow.html
> (sidste eksempel).
>
> Det virker.. i princippet..men jeg kan ikke sætte baggrundsfarven
> når funktionen er aktiv.
>
> Nogen som har en bedre løsning ?
>
> Mvh
Hej T
Jeg blev inspireret af Jørgens idé med at bruge shapes, så
her er et alternativ:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
'Leo Heuser, 10-7-2007
'Moves the cursor in a colored "cross".
'Based on Jørgen Bondesen's idea of using shapes to avoid
'colored cells from having their colors removed.
Dim CheckRange As Range
Dim ColumnSize As Long
Dim GhostColumn(1 To 4, 1 To 2) As Single
Dim GhostRow(1 To 4, 1 To 2) As Single
Dim RowSize As Long
Dim Sh As Shape
On Error Resume Next
For Each Sh In ActiveSheet.Shapes. _
Range(Array("GhostRow", "GhostColumn"))
Sh.Delete
Next Sh
On Error GoTo 0
With ActiveWindow
Set CheckRange = Cells(.ScrollRow, .ScrollColumn)
With .VisibleRange
RowSize = .Rows.Count
ColumnSize = .Columns.Count
End With
End With
With Application
Set CheckRange = CheckRange. _
Resize(.Min(RowSize, Columns(1). _
Cells.Count - CheckRange.Row + 1), _
.Min(ColumnSize, Rows(1). _
Cells.Count - CheckRange.Column + 1))
End With
GhostRow(1, 1) = CheckRange.Left
GhostRow(1, 2) = Target.Top + Target.Height
GhostRow(2, 1) = CheckRange.Left + CheckRange.Width
GhostRow(2, 2) = GhostRow(1, 2)
GhostRow(3, 1) = GhostRow(2, 1)
GhostRow(3, 2) = Target.Top
GhostRow(4, 1) = GhostRow(1, 1)
GhostRow(4, 2) = GhostRow(3, 2)
GhostColumn(1, 1) = Target.Left
GhostColumn(1, 2) = CheckRange.Top
GhostColumn(2, 1) = GhostColumn(1, 1)
GhostColumn(2, 2) = GhostColumn(1, 2) + CheckRange.Height
GhostColumn(3, 1) = GhostColumn(1, 1) + Target.Width
GhostColumn(3, 2) = GhostColumn(2, 2)
GhostColumn(4, 1) = GhostColumn(3, 1)
GhostColumn(4, 2) = GhostColumn(1, 2)
With ActiveSheet.Shapes
.AddPolyline(GhostRow).Select
Selection.Name = "GhostRow"
.AddPolyline(GhostColumn).Select
Selection.Name = "GhostColumn"
With .Range(Array("GhostRow", "GhostColumn")).Line
.Weight = 1.5
.ForeColor.SchemeColor = 17
End With
End With
Target.Activate
End Sub
--
Med venlig hilsen
Leo Heuser
Followup to newsgroup only please.