use ur textbox where i use dd,mm,yyyy veriable
Dim app As Excel.Application
Dim wb As Excel.Workbook
Dim sheet As Excel.Worksheet
Dim var As Variant
Set app = New Excel.Application
Dim path As String
Set wb = app.Workbooks.Open(filepath)
Set sheet = wb.Worksheets.Item("JAN-2012")
Dim c As Integer
c = 2
With sheet
Dim lastrow As Integer
Do While .Cells(c, 1) <> ""
c = c + 1
Loop
End With
With sheet
Dim strdata As String
Dim i As Integer
Dim n As Integer
Dim dy1 As String
Dim dy As String
dy = DateTime.Date
dy1 = Format(dy, "dd/mm/yyyy")
For i = 2 To c - 1 Step 1
strdata = .Cells(i, 1)
dd = Format(strdata, "dd/mm/yyyy")
mm = Format(strdata, "mm/yyyy")
yy = Format(strdata, "yyyy")
dd1 = Format(dy1, "dd/mm/yyyy")
mm1 = Format(dy1, "mm/yyyy")
yy1 = Format(dy1, "yyyy")
If dd = dd1 Then
day = day + 1
End If
If mm = mm1 Then
month = month + 1
End If
If yy = yy1 Then
year = year + 1
End If
Next i
End With
Dim d1 As String
Dim mo1 As String
Dim ye1 As String
d1 = decimal_a(CStr(day))
mo1 = decimal_a1(CStr(month))
ye1 = decimal_a2(CStr(year))
Dim str As String
str = "M;" + d1 + ";" + mo1 + ";" + ye1 + ";;"
MsgBox str
wb.Close
app.Quit
Set sheet = Nothing
Set eb = Nothing
Set app = Nothing