Çizgileri seçmek...

turkuaz

New Member
Joined
Apr 22, 2004
Messages
15
Bu forumda bir soru vardı. Ancak cevaplanmadı.
Örneğin:
5 tane çizgi (Line) çizdik.
Bunlardan boyu 10 cm olanları seçmek istiyoruz...
Nasıl yapacağız...
 

Excel Facts

Pivot Table Drill Down
Double-click any number in a pivot table to create a new report showing all detail rows that make up that number
turkuaz,

Excel çalışma sayfasına boyu 10 cm olan ve olmayan çizgiler çizdiniz ve 10 cm olanları makro aracılığıyla tanıyıp çoklu seçim yapmak istiyorsunuz.

Aşağıdaki kodu deneyebilirsiniz.

Code:
Sub SelectLines()
Dim sht As Worksheet
Dim shp As Shape
Dim arr()

    Set sht = ActiveSheet
    ReDim arr(0)
    For Each shp In sht.Shapes
        If shp.Type = 9 Then
            If shp.Width = Application.CentimetersToPoints(10) Then
                arr(UBound(arr)) = shp.Name
                ReDim Preserve arr(UBound(arr) + 1)
            End If
        End If
    Next shp
    If UBound(arr) = 0 Then Exit Sub
    ReDim Preserve arr(UBound(arr) - 1)
    sht.Shapes.Range(arr).Select
End Sub

10 cm kriteri bu şekilde karşılaştırabilinecek mi emin değilim fakat 10 cm'lik çizgilerden birini seçip sonra VBA'da Immediate (Debug) penceresinde aşağıdaki kodu yazıp Enter'e basarsanız

Print Selection.Width

kod içersinde aşağıda belirttiğim kod satırını göreceğiniz sayı ile değiştirebilir ve kodun doğru olarak çalışmasını sağlayabilirsiniz.

If shp.Width = Application.CentimetersToPoints(10) Then

Örnek verelim: immediate penceresinde gerekli kodu işlettikten sonra diyelim ki 254 gördünüz. Bu taktirde kod satırını aşağıdaki gibi değiştirin.

If shp.Width = 254 Then

Umarım yardımcı olur.

Suat
 
Upvote 0
smozgur,
Sana ne kadar teşekkür etsem azdır. Beni büyük bir dertten kurtardınız..

sht.Shapes.Range(arr).Select

bu kısım önemliydi benim için...
 
Upvote 0

Forum statistics

Threads
1,226,730
Messages
6,192,705
Members
453,748
Latest member
akhtarf3

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top