bthn35
Altın Üye
- Katılım
- 12 Kasım 2009
- Mesajlar
- 201
- Excel Vers. ve Dili
- 365 ProPlus TR
- Altın Üyelik Bitiş Tarihi
- 17-11-2026
DOSYA İndirmek/Yüklemek için ÜCRETLİ ALTIN ÜYELİK Gereklidir!
Altın Üyelik Hakkında Bilgi
Sub test()
Dim i, ii, a, bl, s1, s2, bas, son
With CreateObject("VbScript.Regexp")
.Pattern = "([\d:\s]+)-([\d:\s]+)"
For i = 17 To Cells(Rows.Count, "G").End(3).Row
If .test(Cells(i, "G").Value) Then
Set a = .Execute(Cells(i, "G").Value)
bl = Split(a(0), "-")
s1 = Trim(bl(0))
If InStr(s1, ":") = 0 Then s1 = s1 & ":00"
s2 = Trim(bl(1))
If InStr(s2, ":") = 0 Then s2 = s2 & ":00"
bas = Hour(s1) * 2 + IIf(Minute(s1) = 30, 1, 0) - 6
son = Hour(s2) * 2 + IIf(Minute(s2) = 30, 1, 0) - 6
For ii = bas To son
Cells(i, ii).Value = "*"
Next ii
End If
Next i
End With
End Sub
G sütununda bir format daha varmış, onu da ayarlayabilir misiniz?Kod:Sub test() Dim i, ii, a, bl, s1, s2, bas, son With CreateObject("VbScript.Regexp") .Pattern = "([\d:\s]+)-([\d:\s]+)" For i = 17 To Cells(Rows.Count, "G").End(3).Row If .test(Cells(i, "G").Value) Then Set a = .Execute(Cells(i, "G").Value) bl = Split(a(0), "-") s1 = Trim(bl(0)) If InStr(s1, ":") = 0 Then s1 = s1 & ":00" s2 = Trim(bl(1)) If InStr(s2, ":") = 0 Then s2 = s2 & ":00" bas = Hour(s1) * 2 + IIf(Minute(s1) = 30, 1, 0) - 6 son = Hour(s2) * 2 + IIf(Minute(s2) = 30, 1, 0) - 6 For ii = bas To son Cells(i, ii).Value = "*" Next ii End If Next i End With End Sub