• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Adding data next to the week number.

silverback

New Member
Any help would be greatly appreciated.

In column A3:A54 are week numbers.

In column B3:B54 are costs (currency).

In any other cell, for instance K10, I would like to enter an amount paid, and for it to be entered in column B next to the week number.

If in any week multiple entries are made to K10 they would be added to previously entered amounts.

For week number, =WEEKNUM(TODAY()).


Many thanks in taking the time to look at this for me.
 
Hi, silverback!


First of all welcome to Chandoo's website Excel forums. Thank you for your joining us and glad to have you here.


As a starting point I'd recommend you to read the three first green sticky topics at this forums main page. There you'll find general guidelines about how this site and community operates (introducing yourself, posting files, netiquette rules, and so on).


Among them you're prompted to perform searches within this site before posting, because maybe your question had been answered yet.


Feel free to play with different keywords so as to be led thru a wide variety of articles and posts, and if you don't find anything that solves your problem or guides you towards a solution, you'll always be welcome back here. Tell us what you've done, consider uploading a sample file as recommended, and somebody surely will read your post and help you.


And about your question...


Give a look at this file:

https://dl.dropbox.com/u/60558749/Adding%20data%20next%20to%20the%20week%20number.%20%28for%20silverback%20at%20chandoo.org%29.xlsm


Here's the involved code:

-----

[pre]
Code:
Option Explicit

Private Sub Worksheet_Change(ByVal Target As Range)
' constants
Const ksTestRange = "K10"
Const ksSearchRange = "A3:A56"
Const ksActualWeek = "B2"
' declarations
Dim rngT As Range, rngS As Range
Dim iAW As Integer
' start
Set rngT = Range(ksTestRange)
If Application.Intersect(Target, rngT) Is Nothing Then Exit Sub
' process
iAW = Range(ksActualWeek).Cells(1, 1).Value
Set rngS = Range(ksSearchRange)
With rngS
.Cells(iAW, 2).Value = .Cells(iAW, 2).Value + rngT.Cells(1, 1).Value
End With
Set rngS = Nothing
' end
Set rngT = Nothing
End Sub
[/pre]
-----


Regards!
 
Back
Top