Try to search your question here, if you can't find : Ask Any Question Now ?

Cell modification function in VBA

HomeCategory: stackoverflowCell modification function in VBA
willson asked 2 weeks ago

I’m taking my first steps in VBA and I am trying to make a function that allows me to change the value of a cell to a “FALSE” value if certain conditions of an IF statement are met.

this is what I have so far

Function active_users(cad_desde As Date, cad_fin As Date, last_log As Date, creacion As Date, per_desde As Date, per_fin As Date, download As Date, bloq As Integer)

Dim result As String
result = "False"

If bloq = 0 Or bloq = 128 Then
    If cad_fin < per_desde And last_log < per_desde Then
        Range("P3").Value = "False"
    ElseIf cad_fin >= per_desde And cad_fin <= download And download <= per_fin And last_log < per_desde Then
        Range("P3").Value = "False"
    End If
End If

End Function

when I execute the function, I get a “#VALUE!” and if I make a error checking , it tells me that one of the values types used in the formula is incorrect, but it should be noted that this only happens if I add the line “Range (” P3 “). Value =” False “”. Otherwise the function is executed, although clearly without giving any results other than a “0” in the cell.


1 Answers
Best Answer
Matthias answered 2 weeks ago
Your Answer

14 + 14 =

Popular Tags

WP Facebook Auto Publish Powered By :