Friday, 6 September 2013

MS Excel VBA: Target to match on another sheet and clear/enter static data on that sheet

MS Excel VBA: Target to match on another sheet and clear/enter static data
on that sheet

Here is my problem: On my sheet called "Opportunities", I have a drop down
with an option called "Moved to Last Planner" this uses a worksheet_change
function to move a project name over to my "Last Planner" sheet. On the
last planner sheet, a user will enter various data on the 5 lines provided
for each project. I have Milestone 1-5 as placeholders. Ok, back on the
"Opportunities" sheet, if a user changes their previous selection to
"*Removed from Last Planner" it wipes the project name from the "Last
Planner" tab - this is fine - BUT, I also need it to restore the Milestone
1-5 placeholders in Column D and wipe all of the other data in columns
F-H. In other words, if a project is removed, I want all related data to
be removed also so it's a clean slate for another project entry.
The trick is, I don't know how to match up the target from the
"Opportunities" sheet with the right Project in the "last Planner" sheet
and offset it so it restores/wipes the correct associated columns/lines of
data. You can play with it to see what I mean, not sure I explained it
well. It should be as simple as matching the target on the opportunities
sheet with the matching project name on the last planner sheet and
offsetting in some way, but Im stuck... The "Case" for "*Removed from Last
Planner" in the vba code would be where the change is needed I'm thinking.
I just don't know how to match the target with the correct project and
capture the row so the piece of code that makes the edits knows which row
to start in... TIA
Link to Excel file

No comments:

Post a Comment