Criteria Function Not Working

Technically, that embedded "-" makes the whole thing a string anyway. You could have just removed all spaces before exiting the subroutine using the Replace function outside of the big IF ladder but before the Exit Sub (or End Sub).

Code:
GetPriorPayPeriod = Replace( GetPriorPayPeriod, " ", "" )

 
I haven't tried Val(tt). I assume it works but I'm going to keep it the way I have it because I feel it's proper coding form to do so.
 
Because you're concatenating? Did you try Val(tt)?
Yes?, I created a string and then used Val() and concatenated a sting, which is what the O/P was doing?
Am I missing something different here?
Code:
tt="2019"
? val(tt)-1 & "last char"
2018last char
/code]
 
Technically, that embedded "-" makes the whole thing a string anyway. You could have just removed all spaces before exiting the subroutine using the Replace function outside of the big IF ladder but before the Exit Sub (or End Sub).

Code:
GetPriorPayPeriod = Replace( GetPriorPayPeriod, " ", "" )

You're right. For me, it's just my way of coding. I like to do things "right" the first time and not have issues instead of putting in code to clean up messes like this later.
 
Am I missing something different here?
Just that I think you're missing my original point - that Val seemed to add a space. Posting Val wrapped in Str and then saying it didn't behave the same doesn't really reflect what I posted, does it, regardless of what the OP was doing?
 

Users who are viewing this thread

Back
Top Bottom