I
ina
Hello Guys,
I have this function:
Function mafunction(ByVal client As String) as variant
Dim beginofmonth, endofmonth, startdate, currentdate, todaydate,
DateAuthor As Date
Dim i, r As Integer
Dim value As Variant
todaydate = Date
startdate = "12/03/2004"
endofmonth = getendofmonth(startdate)
i = 0
currentdate = endofmonth
While DateDiff("m", currentdate, todaydate) > 0
currentdate = getnextday(currentdate)
If DateDiff("d", beginofmonth, currentdate) < 0 Then
value= Evaluate("na()") '
currentdate = beginofmonth
End If
Dim var(1000, 6) As Variant (here I have a problem )
DateAuthor = Date
r = 1
var(r, 0) = internalcode
var(r, 1) = currentdate
var(r, 2) = "ROOM"
var(r, 3) = "VACATION"
var(r, 4) = "COMMENTS"
var(r, 5) = DateAuthor
r = r + 1
currentdate = getnextendofmonth(currentdate)
Wend
mafunction = var ( I have a problem here)
End Function
'I would like to call my fuction from one sub
as
Sub test()
Dim ClientCode, Code As String
ClientCode = InputBox("Client Code", ClientCode)
Code = mafunction (ClientCode)
End Sub
I cannot display the array in my worksheet. I am newbie in vba
programming and I can not figure out where the problem is.
Ina
I have this function:
Function mafunction(ByVal client As String) as variant
Dim beginofmonth, endofmonth, startdate, currentdate, todaydate,
DateAuthor As Date
Dim i, r As Integer
Dim value As Variant
todaydate = Date
startdate = "12/03/2004"
endofmonth = getendofmonth(startdate)
i = 0
currentdate = endofmonth
While DateDiff("m", currentdate, todaydate) > 0
currentdate = getnextday(currentdate)
If DateDiff("d", beginofmonth, currentdate) < 0 Then
value= Evaluate("na()") '
currentdate = beginofmonth
End If
Dim var(1000, 6) As Variant (here I have a problem )
DateAuthor = Date
r = 1
var(r, 0) = internalcode
var(r, 1) = currentdate
var(r, 2) = "ROOM"
var(r, 3) = "VACATION"
var(r, 4) = "COMMENTS"
var(r, 5) = DateAuthor
r = r + 1
currentdate = getnextendofmonth(currentdate)
Wend
mafunction = var ( I have a problem here)
End Function
'I would like to call my fuction from one sub
as
Sub test()
Dim ClientCode, Code As String
ClientCode = InputBox("Client Code", ClientCode)
Code = mafunction (ClientCode)
End Sub
I cannot display the array in my worksheet. I am newbie in vba
programming and I can not figure out where the problem is.
Ina