• DİKKAT

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

seçili satırı çerçeveleme

Katılım
29 Ekim 2011
Mesajlar
138
Excel Vers. ve Dili
2007 türkçe
Merhaba,

Çalışma sayfam satır ve sütun olarak büyüktür. makro ile excel sayfasında klavye ile ya da mouse ile seçili seçili satırı kalın çerçeve içine nasıl alabiliriz. Örneğin; a3 hücresine geldiğim zaman a3 ile az3 arasındaki satırları kalın çerçeve içine alsın..
 
Son düzenleme:
İki örnek de seçili hücrenin rengini kaybediyor. Ben hücredeki rengini görebilmek için çerçeve olsun istemiştim ama aynısı oldu.
 
Aşağıdaki kodlar ile yapabilirsiniz. Yalnız sayfa seçimini pasif yapamadım.
Kod:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
On Error Resume Next
    Cells.Select
    Selection.Borders(xlDiagonalDown).LineStyle = xlNone
    Selection.Borders(xlDiagonalUp).LineStyle = xlNone
    Selection.Borders(xlEdgeLeft).LineStyle = xlNone
    Selection.Borders(xlEdgeTop).LineStyle = xlNone
    Selection.Borders(xlEdgeBottom).LineStyle = xlNone
    Selection.Borders(xlEdgeRight).LineStyle = xlNone
    Selection.Borders(xlInsideVertical).LineStyle = xlNone
    Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
    
If Intersect(Target, [A1:Q50]) Is Nothing Then Exit Sub
  
''''''''''''''''''''''''''''''''''''''''''''''''''
  With Range(Cells(Target.Row, 1), Cells(Target.Row, 17)).Borders(xlEdgeLeft)
        .LineStyle = xlContinuous
        .ColorIndex = 0
        .TintAndShade = 0
        .Weight = xlMedium
    End With
    With Range(Cells(Target.Row, 1), Cells(Target.Row, 17)).Borders(xlEdgeTop)
        .LineStyle = xlContinuous
        .ColorIndex = 0
        .TintAndShade = 0
        .Weight = xlMedium
    End With
    With Range(Cells(Target.Row, 1), Cells(Target.Row, 17)).Borders(xlEdgeBottom)
        .LineStyle = xlContinuous
        .ColorIndex = 0
        .TintAndShade = 0
        .Weight = xlMedium
    End With
    With Range(Cells(Target.Row, 1), Cells(Target.Row, 17)).Borders(xlEdgeRight)
        .LineStyle = xlContinuous
        .ColorIndex = 0
        .TintAndShade = 0
        .Weight = xlMedium
    End With
    
''''''''''''''''''''''''''''''''''''''''''''''''''
End Sub
 
Aşağıdaki kodlar ile yapabilirsiniz. Yalnız sayfa seçimini pasif yapamadım.
Kod:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
On Error Resume Next
    Cells.Select
    Selection.Borders(xlDiagonalDown).LineStyle = xlNone
    Selection.Borders(xlDiagonalUp).LineStyle = xlNone
    Selection.Borders(xlEdgeLeft).LineStyle = xlNone
    Selection.Borders(xlEdgeTop).LineStyle = xlNone
    Selection.Borders(xlEdgeBottom).LineStyle = xlNone
    Selection.Borders(xlEdgeRight).LineStyle = xlNone
    Selection.Borders(xlInsideVertical).LineStyle = xlNone
    Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
    
If Intersect(Target, [A1:Q50]) Is Nothing Then Exit Sub
  
''''''''''''''''''''''''''''''''''''''''''''''''''
  With Range(Cells(Target.Row, 1), Cells(Target.Row, 17)).Borders(xlEdgeLeft)
        .LineStyle = xlContinuous
        .ColorIndex = 0
        .TintAndShade = 0
        .Weight = xlMedium
    End With
    With Range(Cells(Target.Row, 1), Cells(Target.Row, 17)).Borders(xlEdgeTop)
        .LineStyle = xlContinuous
        .ColorIndex = 0
        .TintAndShade = 0
        .Weight = xlMedium
    End With
    With Range(Cells(Target.Row, 1), Cells(Target.Row, 17)).Borders(xlEdgeBottom)
        .LineStyle = xlContinuous
        .ColorIndex = 0
        .TintAndShade = 0
        .Weight = xlMedium
    End With
    With Range(Cells(Target.Row, 1), Cells(Target.Row, 17)).Borders(xlEdgeRight)
        .LineStyle = xlContinuous
        .ColorIndex = 0
        .TintAndShade = 0
        .Weight = xlMedium
    End With
    
''''''''''''''''''''''''''''''''''''''''''''''''''
End Sub

teşekkürler , hem tüm sayfayı seçiyor hem de varolan sayfa çizgilerini kaldırıyor.
 
Geri
Üst