Results 1 to 5 of 5

weeknum & VBA

Threaded View

soakaos weeknum & VBA 01-05-2010, 10:30 AM
JBeaucaire Re: weeknum & VBA 01-05-2010, 10:50 AM
soakaos Re: weeknum & VBA 01-05-2010, 11:48 AM
JBeaucaire Re: weeknum & VBA 01-05-2010, 01:28 PM
soakaos Re: weeknum & VBA 01-06-2010, 12:07 PM
  1. #1
    Registered User
    Join Date
    01-05-2010
    Location
    Lausanne, Switzerland
    MS-Off Ver
    Excel 2003
    Posts
    7

    weeknum & VBA

    Hello hello,

    Freshly registered on this forum, I'm here to find a little support with some of Excel functions I'm still not used too.. I'm very new in VBA so please, accept per advance my excuses if I'm not 100% clear with the terminology..

    Well.. I got a file from my boss that is linked to an online table. This table contains customer contacts infos such as account number, activation date & time, etc, etc.. (1 contact = 1 line)

    Now (for "quick filtering reasons" he said), my boss "needs" to have also in the sheet the week number for every contact we had..(as well as Month & Year)
    and as the list grows up everyday with new entries, I thought I could use VBA..
    so I wrote a little something that uses the date&time column to have the wanted infos added on every line :

    Private Sub Worksheet_change (Target As Range)
    
    Set MyPlage = Range("G2", Range("G65536").End(xlUp))
    For Each cell In MyPlage
            
            cell.Offset(0, 9) = "=MONTH(RC[-9])"
            cell.Offset(0, 10) = "=year(RC[-10])"
            cell.Offset(0, 11) = "=weeknum(RC[-11])"
            
           Next
    End
    End Sub
    It works fine with the Month & the year, both return the correct value in the right cells.

    But I can't find a way to have it working with the weeknum one.. it returns me a 4 digit value...

    For example, with "23.12.2009 09:07" (cell format = custom dd.mm.yyyy hh:mm), the weeknum returns me the value 5740 (when cell format is general, and "01.07.1905 00:00" when in date format) when it should returns me 52!

    my only explanation is that it calculates the amount of weeks from 01.01.1900 to 23.12.2009 but yeah... it's not exactly what I need..

    Does anyone know how I could solved this issue ? or how I could pass by ?

    Thanks in advance for your answer,
    I hope you'll understand my question, I'm not that used to write "technical" things in english..

    merci merci,
    steve

    Last edited by soakaos; 01-06-2010 at 12:08 PM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1