Dears,
i hope that someone could help me to understand better why the following code does not function well.
Sub weektodata()
Dim xWs, xDWs As Worksheet
Dim filtrodata, filtrodata2 As Date
Dim iWeek, iYear As Integer
xDStr = "Home"
On Error Resume Next
Set xDWs = Worksheets(xDStr)
iWeek = xDWs.Cells(2, 4).Value
iYear = 2019
filtrodata = DateSerial(iYear, 1, ((iWeek - 1) * 7) + 2 - Weekday(DateSerial(iYear, 1, 1)) + 1)
filtrodata2 = Format(filtrodata, "dd.MMM.aaaa")
MsgBox (filtrodata)
End Sub
but if you the contets of the variable
VBA.PNG
Did I do something wrong? What am I missing?
Thanks a lot.
Rossofoco
Bookmarks