Greetings!
What I want to accomplish is that the macro finds the current date in a horizontal table with multiple rows of dates, and then add one number below and below that 3 other numbers as %-numbers in that style: xx/yy/zz (30/40/30 for example). The point is it should not add the digits after the commata, but take the full number without %-symbol (37,53% =38). You can find my code here, its commented to make it easy to understand. By helping me you would make me very happy
because I'm not getting it on my own or with google like my other macros.
Sub Tagebucheintrag()
Dim Kcal As Integer 'Kcal ist the first number
Dim Prot As Integer 'these 3 are the %-numbers to be added in the 2nd cell below the date xx/yy/zz
Dim Carb As Integer
Dim Fat As Integer
Kcal = Worksheets("Diätplaner").Cells(36, 5).Value
Prot = Worksheets("Diätplaner").Cells(37, 6).Value
Carb = Worksheets("Diätplaner").Cells(37, 6).Value
Fat = Worksheets("Diätplaner").Cells(37, 6).Value 'I set the variables with the numbers I want to be written below the date
Worksheets("Diätlog").Activate
Range("B1:B1,AF:AF").Find(Date).select 'in the other worksheet I search in the range of b1 to the end of AF for the current date.
Cells(ActiveCell.Row + 1, ActiveCell.Column).Value = Kcal 'the macro adds the first variable into the cell below
Cells(ActiveCell.Row +2,activecell.column).value = Prot&"/"&Carb&"/"&Fat 'the macro combines the 3 variables to the format xx/yy/zz
End Sub
Ive tried it and it doesnt even find the current date and selects the cell :/
Yours sincerely,
Taktiker from Germany, who feels drunken from doing Excel macros without really having any knowledge about VBA
Bookmarks