• DİKKAT

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

Vba comboboxların içindeki değerleri aratıp bulduktan sonra if döngüsünde değeri büyük olanı yazdırmak istiyorum

Katılım
5 Aralık 2019
Mesajlar
1
Excel Vers. ve Dili
excel vba 2019
Option Explicit
Private Sub ComboBox1_Change()

Dim sh As Worksheet
Set sh = ThisWorkbook.Sheets("sayfa3")
Dim i As Integer
Dim n As Integer
n = Application.WorksheetFunction.Match(Me.ComboBox1.Value, sh.Range("1:1"), 0)


Me.ComboBox2.Clear
For i = 2 To Application.WorksheetFunction.CountA(sh.Cells(1, n).EntireColumn)
Me.ComboBox2.AddItem sh.Cells(i, n).Value



Next i

End Sub


Private Sub UserForm_Activate()
Dim sh As Worksheet
Set sh = ThisWorkbook.Sheets("sayfa3")
Dim i As Integer

Me.ComboBox1.Clear
For i = 1 To Application.WorksheetFunction.CountA(sh.Range("1:1"))
Me.ComboBox1.AddItem sh.Cells(1, i).Value

Me.ComboBox3.Clear

Next i
For i = 1 To Application.WorksheetFunction.CountA(sh.Range("1:1"))
Me.ComboBox3.AddItem sh.Cells(1, i).Value


Next i

End Sub

Sub Combobox3_Change()
Dim sh As Worksheet
Set sh = ThisWorkbook.Sheets("sayfa3")
Dim i As Integer
Dim n As Integer
n = Application.WorksheetFunction.Match(Me.ComboBox3.Value, sh.Range("1:1"), 0)
Me.ComboBox4.Clear
For i = 2 To Application.WorksheetFunction.CountA(sh.Cells(1, n).EntireColumn)
Me.ComboBox4.AddItem sh.Cells(i, n).Value


Next i

End Sub

Private Sub CommandButton1_Click()
'Dim a As Currency
'Dim ws As Worksheet
deger = ComboBox2.Value
Sub virgulSagSil()
Dim i As Currency
Dim f As Currency
Dim cell As Range
Dim virgulInd As Integer
Dim degerlInd As Integer
For Each cell In Range("B1:B1111")
virgulInd = InStr(cell.Value, ComboBox2.Value)
If virgulInd > 0 Then
Range("B&j") = i
MsgBox i
End If
degerlInd = InStr(cell.Value, ComboBox4.Value)
If degerlInd > 0 Then
Range("B&j") = f

End If
Next cell

Next


If f > i Then
MsgBox ComboBox2.Value
Else

MsgBox ComboBox4.Value
End If



End Sub
 
Geri
Üst