SLyFeLLowTR 1
SLyFeLLowTR
DEVLOPER 1
DEVLOPER
noisiv 1
noisiv
Manwe Work 1
Manwe Work
mavzermete 1
mavzermete
darkbey42 1
darkbey42
xranzei 1
xranzei
Bvural41 1
Bvural41
PrimeAC 1
PrimeAC
Payidar2 1
Payidar2
Fethi Polat 1
Fethi Polat
Wizard' 1
Wizard'
Hikaye Ekle

Vb üzerinden excelde arama yapmak

  • Konuyu başlatan Konuyu başlatan AcimasiZz-
  • Başlangıç tarihi Başlangıç tarihi
  • Cevaplar Cevaplar 1
  • Görüntüleme Görüntüleme 585

HERAKLES Otomatik Avlı kalıcı sunucu. 19 Haziran'da açılıyor. Atius & Wizard güvencesiyle hemen kayıt ol, ön kayıt ödülleri aktif. HEMEN TIKLA!

Kod:
Kod:
 Project/References menülerinden "Microsoft Excel 10.0 Object Library" ekleyin,

Formunuza 9 adet text kutusu, 9 adet label ve bir adet command butonu ekleyin,

ve aşağıdaki kodları olduğu gibi forma yapıştırın ve çalıştırın.

Dim c As Excel.Range
Dim xlApp As Excel.Application
Dim xlBook As Excel.Workbook
Dim xlSheet As Excel.Worksheet


Sub ExcelAra()
On Error GoTo hata
Set xlApp = New Excel.Application

Text2.Text = ""

Set xlBook = Workbooks.Open(App.Path & "\devlet_kurumlari.xls", , True)
Set xlSheet = xlBook.Worksheets("sheet 1")


With xlSheet.Range("a1:c65536")
Set c = .Find(Trim(Text1.Text), lookin:=xlValues)
If Not c Is Nothing Then

firstAddress = c.Address

Text2.Text = c.Address


Range(Text2.Text).Select
Text3.Text = Excel.ActiveCell.Row

'??????_______Kurum Adı
Range("$d$" & Text3.Text).Select
Text4.Text = Excel.ActiveCell

'??????_______Kurum İli
Range("$a$" & Text3.Text).Select
Text5.Text = Excel.ActiveCell

'??????_______Kurum İlçesi
Range("$b$" & Text3.Text).Select
Text6.Text = Excel.ActiveCell

'??????_______Kurum Telefonu
Range("$e$" & Text3.Text).Select
Text7.Text = Excel.ActiveCell
MaskEdBox1.Text = Excel.ActiveCell
'??????_______Kurum Fax
Range("$f$" & Text3.Text).Select
Text8.Text = Excel.ActiveCell

'??????_______Kurum Adres
Range("$g$" & Text3.Text).Select
Text9.Text = Excel.ActiveCell



Do
c.Interior.Pattern = xlPatternGray50
Set c = .FindNext(c)
Loop While Not c Is Nothing And c.Address <> firstAddress
End If
End With

If Text2.Text = "" Then Text2.Text = "Bulunamadı..."




xlBook.Close False
xlApp.Quit

Exit Sub
hata:
MsgBox Err.Description

End Sub

Private Sub Command1_Click()
ExcelAra
 

Şu an konuyu görüntüleyenler (Toplam : 0, Üye: 0, Misafir: 0)

Geri
Üst