Microsoft Office Excel ® Kod Kılavuzu

Microsoft Office Excel® Code Guide

10 Ağustos 2009 Pazartesi

Intersection and Union Areas



'Module1

Option Explicit
Dim i As Single
Dim Hane As Range
Dim Ada As Range
Dim Parsel As Range
Dim Kontrol As Variant

Sub Test()
On Error Resume Next
ArsaKontrolü Range("Sayfa1!B4:B9"), Range("Sayfa1!A1:G36")
End Sub
Private Sub ArsaKontrolü(ByVal Veri1 As Range, Veri2 As Range)
On Error GoTo Hata
Set Ada = Veri1
Set Parsel = Veri2
Set Kontrol = Application.Intersect(Ada, Parsel)
If Kontrol Is Nothing Then
MsgBox "Ranges do not intersect"
Else
i = 1
For Each Hane In Kontrol
Application.Union(Hane, Hane).Interior.ColorIndex = i
i = i + 1
Next Hane
Kontrol.Offset(0, 1).Select
End If
Exit Sub
Hata:
Err.Clear
Set Hane = Nothing
Set Kontrol = Nothing
Set Ada = Nothing
Set Parsel = Nothing
End Sub

Hiç yorum yok:

Blog Arşivi

Bu gadget'ta bir hata oluştu

Bu Blogda Ara

Contributor

Contributor
Mustafa ULUSARAÇ İstanbul, TÜRKİYE
free counters
T. C. Central Bank Indicative Exchange Rates
Currency Exchange Rate Widget,Currency Converter Widget
Borsa İstanbul