+ Reply to Thread
Results 1 to 10 of 10

Weight Watchers Points Tracker

  1. #1
    Registered User
    Join Date
    11-22-2007
    Posts
    60

    Weight Watchers Points Tracker

    I'm trying to make a points calculator and tracker for a diet.

    I have the forumla from wikipedia and it calculates the point now I want to record the date, food, meal & Points on a second sheet.

    I enter that data in

    E1 =Date
    E2 = Point (calculated)
    E3 = Meal (Breakfast, Lunch, Dinner Etc)
    E4 Food (text)
    E6 Calories (number)
    E7 Saturated Fat (number)

    I want to add a button that records this data to another work sheet and clears the inputs I have made.

    The following Date should be carried across
    E1, E2, E3 & E4 into A2, B2, C2 & D2 (or the next available row)

    The following Cells should be cleared (E1, E3, E4, E6 & E7)

    Thanks for your help.
    Attached Files Attached Files

  2. #2
    Forum Contributor
    Join Date
    03-24-2004
    Location
    Edam Netherlands
    Posts
    181
    First I would change the formula to

    =IF(AND(ISNUMBER(E6),ISNUMBER(E7)),MROUND(((E6/69.8)+(E7/4.12)),0.5),"")

    Then add a button to run the following code.

    Sub Record()

    Dim iLastRow As Long

    If IsNumeric(Sheet1.Range("E2").Value) Then

    iLastRow = Sheet2.Range("A" & Rows.Count).End(xlUp).Row

    Sheet2.Range("A1").Offset(iLastRow, 0).Value = Sheet1.Range("E1").Value
    Sheet2.Range("B1").Offset(iLastRow, 0).Value = Sheet1.Range("E2").Value
    Sheet2.Range("C1").Offset(iLastRow, 0).Value = Sheet1.Range("E3").Value
    Sheet2.Range("D1").Offset(iLastRow, 0).Value = Sheet1.Range("E4").Value

    Sheet1.Range("E1").ClearContents
    Sheet1.Range("E3").ClearContents
    Sheet1.Range("E4").ClearContents
    Sheet1.Range("E6").ClearContents
    Sheet1.Range("E7").ClearContents

    End If

    End Sub
    Last edited by Kaak; 04-15-2008 at 08:57 AM.

  3. #3
    Registered User
    Join Date
    03-01-2007
    Posts
    37

    Points Tracker

    File attached, --- uploaded file again, but here is the code

    Please Login or Register  to view this content.
    Attached Files Attached Files
    Last edited by cmcconna; 04-15-2008 at 09:59 AM.

  4. #4
    Forum Contributor
    Join Date
    03-24-2004
    Location
    Edam Netherlands
    Posts
    181
    Looks a awful lot like my post cmcconna....?

  5. #5
    Registered User
    Join Date
    03-01-2007
    Posts
    37
    You are right, it does look similar . . . If ya want it have it,

    but.....
    Two main differences on the posts....

    1st Ive based it on the cell being empty not a numeric
    2nd i've got the info going into the correct cells

    we are all here to help and learn. thanks

  6. #6
    Registered User
    Join Date
    11-22-2007
    Posts
    60
    Either way for some reason I can't download it?

    Thanks for the code - But maybe I have inputted it wrong - I get a compile error - Expected End Sub

    Where was I supposed to paste the code to - I put it between

    Private Sub Save_Click() (now highlighted)

    End Sub

    ******************************
    Private Sub Save_Click()
    Sub Record()

    Dim iLastRow As Long

    If IsNumeric(Sheet1.Range("E2").Value) Then

    iLastRow = Sheet2.Range("A" & Rows.Count).End(xlUp).Row

    Points Tracker.Range("A1").Offset(iLastRow, 0).Value = Points_Calculator.Range("E1").Value
    Points Tracker.Range("B1").Offset(iLastRow, 0).Value = Points_Calculator.Range("E2").Value
    Points Tracker.Range("C1").Offset(iLastRow, 0).Value = Points_Calculator.Range("E3").Value
    Points Tracker.Range("D1").Offset(iLastRow, 0).Value = Points_Calculator.Range("E4").Value

    Points_Calculator.Range("E1").ClearContents
    Points_Calculator.Range("E3").ClearContents
    Points_Calculator.Range("E4").ClearContents
    Points_Calculator.Range("E6").ClearContents
    Points_Calculator.Range("E7").ClearContents

    End If

    End Sub
    End Sub
    **************************************

  7. #7
    Registered User
    Join Date
    11-22-2007
    Posts
    60
    Ignore that - I read it and realised what I had done wrong.



    Thanks for you help works great

  8. #8
    Forum Contributor
    Join Date
    03-24-2004
    Location
    Edam Netherlands
    Posts
    181
    Remove the Sub Record() and one of the End Sub's

  9. #9
    Registered User
    Join Date
    11-22-2007
    Posts
    60
    Thanks - Works great

    Just trying to tidy it up now

    i want to rename Sheet1 to calculator and sheet2 to log

    I assumed (incorrectly) that

    log.Range("A1").Offset(iLastRow, 0).Value = calculator.Range("E1").Value
    Etc.


    Would work I did a find and replace for all sheet1's and sheet2's but it still come up with an error - Do I need "" or '' or something round this?

  10. #10
    Registered User
    Join Date
    11-22-2007
    Posts
    60
    I also want to present my data from sheet2 (log) into a daily log that shows the total points used for each meal type per day and the total used for the day.

    What the best way of doing that with out loads of if statements?

    eg

    Sheet 3 will show the date (15/04/08) which then refers back to sheet2 and adds the total up for breakfast, lunch & dinner. One row for each day)

+ Reply to Thread

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