The formula below allows me to enter a dollar amount in column H the is added to column I where a cumulative total for dollars obligated to a project is totaled.
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Column = 8 And Target.Cells.Count = 1 Then
Target.Offset(0, 1).Value = Target.Offset(0, 1).Value + Target.Value
End If
End Sub
This works fine for the entire column what I want to do is change the code so that a range of cells is considered instead of the entire column. Like Range (H2:H150).
Any help would be greatly appreciated.
That code works on a single cell in column 8 (H) and purely changes the value of the cell you select to include the value of the adjacent cell to the right. If you want to limit it to a range of cells then:
Private Sub Worksheet_Change(ByVal Target As Range) If Target.row < 5 or Target.Row >150 then Exit Sub If Target.Column = 8 And Target.Cells.Count = 1 Then Target.Offset(0, 1).Value = Target.Offset(0, 1).Value + Target.Value End If End Sub
Google Me
Find me located here Simon Lloyd and what i'm about Here
The above is NOT a link to a forum so is NOT against Rule 13
Last edited by Simon Lloyd; 01-26-2012 at 06:04 PM.
Not all forums are the same - seek and you shall find
Your post does not comply with Rule 3 of our Forum RULES. Use code tags around code. Posting code without them makes your code hard to read and difficult to be copied for testing. Highlight your code and click the # at the top of your post window. For more information about these and other tags, found here
Your post does not comply with Rule 1 of our Forum RULES. Your post title should accurately and concisely describe your problem, not your anticipated solution. Use terms appropriate to a Google search. Poor thread titles, like Please Help, Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will be addressed according to the OP's experience in the forum: If you have less than 10 posts, expect (and respond to) a request to change your thread title. If you have 10 or more posts, expect your post to be locked, so you can start a new thread with an appropriate title.
To change a Title on your post, click EDIT then Go Advanced and change your title, if 2 days have passed ask a moderator to do it for you.
PLEASE PM WHEN YOU HAVE DONE THIS AND I WILL DELETE THIS POST
Hope that helps.
RoyUK
--------
If you are pleased with a member's answer then use the Star icon to rate it, if you are pleased enough to part with cash consider a donation to Children in Need
For Excel Tips & Solutions, free examples and tutorials why not check out my downloads
New members please read & follow the Forum Rules
Remember to mark your questions Solved and rate the answer(s)
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks