DOSYA İndirmek/Yüklemek için ÜCRETLİ ALTIN ÜYELİK Gereklidir!
Altın Üyelik Hakkında Bilgi
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim son As Long, i As Long, s As Byte
son = Range("D4:H" & Rows.Count).Find("*", , , , xlByRows, xlPrevious).Row
For i = 5 To son
s = WorksheetFunction.CountA(Cells(i, "D").Resize(1, 4))
If s = 4 And Cells(i, "H") = "" Then
Cells(i, "H").Select
Exit Sub
End If
Next i
End Sub
Merhaba,
Sayfanın kod bölümüne ekleyip deneyiniz.
Kod:Private Sub Worksheet_SelectionChange(ByVal Target As Range) Dim son As Long, i As Long, s As Byte son = Range("D4:H" & Rows.Count).Find("*", , , , xlByRows, xlPrevious).Row For i = 5 To son s = WorksheetFunction.CountA(Cells(i, "D").Resize(1, 4)) If s = 4 And Cells(i, "H") = "" Then Cells(i, "H").Select Exit Sub End If Next i End Sub
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim son As Long, i As Long, s As Byte
SonSatır = Sheets("Sayfa1").Cells(Rows.Count, "D").End(3).Row
For i = 5 To SonSatır
If Cells(i, "D") <> "" And Cells(i, "E") <> "" And Cells(i, "F") <> "" And Cells(i, "G") <> "" Then
If Cells(i, "H") = "" Then
Cells(i, "H").Select
MsgBox "Fiyat Boş Bırakmayınız"
Exit Sub
End If
End If
Next i
End Sub
Kodları SelectionChange olayına yazmışsınız, yani hücre seçilince çalışacak şekilde ayarlamışsınız ve kod içinde de hücre seçme olayı var. Kod hücreyi seçince kodlar baştan tekrar devreye giriyor bu nedenle.
Eğer amacınız hücre seçiminde kodların çalışmasıysa Cells(i,"H").select satırından önce
ApplicationEnableEvents = False
satırını ve sonra da (yani msgbox satırından önce)
ApplicationEnableEvents = True
Satırını ekleyip deneyin.
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim son As Long, i As Long, s As Byte
SonSatır = Sheets("Sayfa1").Cells(Rows.Count, "D").End(3).Row
For i = 5 To SonSatır
If Cells(i, "D") <> "" And Cells(i, "E") <> "" And Cells(i, "F") <> "" And Cells(i, "G") <> "" Then
If Cells(i, "H") = "" Then
ApplicationEnableEvents = False
Cells(i, "H").Select
ApplicationEnableEvents = True
MsgBox "Fiyat Boş Bırakmayınız"
End If
End If
Next i
End Sub