DOSYA İndirmek/Yüklemek için ÜCRETLİ ALTIN ÜYELİK Gereklidir!
Altın Üyelik Hakkında Bilgi
Sub TCMB_ICMAL()
Dim z As Long
On Error Resume Next
[COLOR=Blue][B]Const SON As Long = 50[/B][/COLOR]
Application.Caption = ""
ActiveWindow.Caption = "İşlem başladı bekleyin... - % 0"
For z = 3 To SON
DoEvents
Cells(z, "g").Select
Cells(z, "g") = GET_TCMB(Cells(z, "b"))
ActiveWindow.Caption = _
"İşlem sürüyor bekleyin... - % " & (z * 100) \ SON
Next
Application.Caption = Application.Name
ActiveWindow.Caption = ActiveWorkbook.Name
MsgBox "İşlem tamamlandı...", vbInformation
End Sub
Private Function GET_TCMB(ByRef tarih As Range) As Double
Const URL As String = "URL;http://www.tcmb.gov.tr/kurlar/"
DoEvents
Dim q As QueryTable, t As String, wee As Integer
Dim app As Application, wb As Workbook, sh As Worksheet
On Error Resume Next
Set app = CreateObject("Excel.Application")
Set wb = app.Workbooks.Add
Set sh = wb.Sheets(1)
With app
.DecimalSeparator = "."
.ThousandsSeparator = ","
.UseSystemSeparators = False
End With
wee = Weekday(CDate(tarih), vbMonday)
Select Case wee
Case 1
t = Format$(CDate(tarih) - 3, "yyyymm") & _
"/" & Format$(CDate(tarih) - 3, "ddmmyyyy") & ".html"
Case 7
t = Format$(CDate(tarih) - 2, "yyyymm") & _
"/" & Format$(CDate(tarih) - 2, "ddmmyyyy") & ".html"
Case Else
t = Format$(CDate(tarih) - 1, "yyyymm") & _
"/" & Format$(CDate(tarih) - 1, "ddmmyyyy") & ".html"
End Select
With sh
.Cells.Delete
Set q = .QueryTables.Add(URL & t, .Range("a1"))
With q
.WebFormatting = xlWebFormattingNone
.WebPreFormattedTextToColumns = True
.Refresh False
.Delete
End With
GET_TCMB = .Range("d7").Value
End With
app.UseSystemSeparators = True
wb.Close False
app.Quit
Set sh = Nothing
Set wb = Nothing
Set app = Nothing
Set q = Nothing
End Function