Results 1 to 3 of 3

Thread: help me

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Sep 2004
    Posts
    86

    help me

    how do i say this

    i want a script that clavulates if a number can be split by 4 or not if rest =0 then it should be true

    si if 2004/4=0 this should be true but how do i say this in the coreect script

    it's hard to explain for me

    i want to calculate how many days our second month has this year and next year and so on

  2. #2
    Former Admin/Moderator MartinLiss's Avatar
    Join Date
    Sep 1999
    Location
    San Jose, CA
    Posts
    33,431
    VB Code:
    1. Public Function LastDayOfMonth(ByVal TheDate As Variant) As Integer
    2.  
    3.     LastDayOfMonth = DatePart("d", DateAdd("d", -1, DateAdd("m", 1, DateAdd("d", -DatePart("d", TheDate) + 1, TheDate))))
    4.  
    5. End Function

    Usage:
    MsgBox LastDayOfMonth("2/2004")

  3. #3
    Still learning kebo's Avatar
    Join Date
    Apr 2004
    Location
    Gardnerville,nv
    Posts
    3,762
    First, try using a better subject than "help me."

    I think what you are looking for is the MOD operator. The MOD operator devides two numbers and returns the remainer.
    For example----
    4 mod 2 = 0
    4 mod 3 = 1

    so if your numbers are X & Y then

    Code:
    Dim blnResulstAreZero as Boolean
    
    blnResulstAreZero  = (X MOD Y = 0)
    
    'or you could say
    blnResulstAreZero = False
    if X MOD Y = 0 then blnResulstAreZero = True
    HTH
    kevin
    Process control doesn't give you good quality, it gives you consistent quality.
    Good quality comes from consistently doing the right things.

    Vague general questions have vague general answers.
    A $100 donation is required for me to help you if you PM me asking for help. Instructions for donating to one of our local charities will be provided.

    ______________________________
    Last edited by kebo : Now. Reason: superfluous typo's

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width