• DİKKAT

    DOSYA İndirmek/Yüklemek için ÜCRETLİ ALTIN ÜYELİK Gereklidir!
    Altın Üyelik Hakkında Bilgi

Satır ve Sütun renklendirme

poetika

Altın Üye
Katılım
6 Kasım 2005
Mesajlar
142
Excel Vers. ve Dili
Excel 2010 Türkçe
Yabancı bir siteden aşağıdaki kodu buldum. aktif hücrenin satır ve sütununu renklendiriyor. Aktif hücrenin bulunduğu satırı renklendirsin, fakat aktif hücre,
G4-O4 sütunları arasında ve
X4-AF4 sütunları arasında ve
AN4-BB4 sütunları arasında iken satır ve sütun renklensin. aktif hücre bu aralıklar dışında ise sadece satır renklensin istiyorum.
Yardımcı olur musunuz? Kod şu şekilde:

Sub Worksheet_SelectionChange(ByVal Target As Excel.Range)
Static rr
Static cc

If cc <> "" Then
With Columns(cc).Interior
.ColorIndex = xlNone
End With
With Rows(rr).Interior
.ColorIndex = xlNone
End With
End If

r = Selection.Row
c = Selection.Column
rr = r
cc = c

With Columns(c).Interior
.ColorIndex = 20
.Pattern = xlSolid
End With
With Rows(r).Interior
.ColorIndex = 20
.Pattern = xlSolid
End With
End Sub
 
Merhaba
Aşağıdaki kırmızı bölümleri ekleyip deneyiniz;
Kod:
Sub Worksheet_SelectionChange(ByVal Target As Excel.Range)
Static rr
Static cc
If cc <> "" Then
With Columns(cc).Interior
.ColorIndex = xlNone
End With
With Rows(rr).Interior
.ColorIndex = xlNone
End With
End If
r = Selection.Row
c = Selection.Column
rr = r
cc = c
[COLOR="Red"]If Not Intersect(Target, Range("G4:O4,X4:AF4,AN4:BB4")) Is Nothing Then[/COLOR]
With Columns(c).Interior
.ColorIndex = 20
.Pattern = xlSolid
End With
[COLOR="Red"]End If[/COLOR]
With Rows(r).Interior
.ColorIndex = 20
.Pattern = xlSolid
End With
End Sub
 
Merhaba
Aşağıdaki kırmızı bölümleri ekleyip deneyiniz;
Kod:
Sub Worksheet_SelectionChange(ByVal Target As Excel.Range)
Static rr
Static cc
If cc <> "" Then
With Columns(cc).Interior
.ColorIndex = xlNone
End With
With Rows(rr).Interior
.ColorIndex = xlNone
End With
End If
r = Selection.Row
c = Selection.Column
rr = r
cc = c
[COLOR="Red"]If Not Intersect(Target, Range("G4:O4,X4:AF4,AN4:BB4")) Is Nothing Then[/COLOR]
With Columns(c).Interior
.ColorIndex = 20
.Pattern = xlSolid
End With
[COLOR="Red"]End If[/COLOR]
With Rows(r).Interior
.ColorIndex = 20
.Pattern = xlSolid
End With
End Sub

teşekkür ederim halloldu.
 
Geri
Üst