View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Damil4real Damil4real is offline
external usenet poster
 
Posts: 34
Default Quick VBA Worksheet Change Event or Selection Question:

Quick VBA Worksheet Change Event or Selection Question:


I have a workbook that has a sheet named "Formatted Prices". I enter
data starting from row 7 & from column A to S all the way down on a
daily basis. This range is not completely filled on a daily basis…,
somedays I might just enter 2 or 3 data only filling 3 rows, but
always from column A to S.


In column Q, I have a formula that depends on column P…, it basically
a simple calculation formula that says if the data in say P7 is
empty,
then show nothing, but if the data in P7 is something, then subtract
today's date from P7. The data in P7 is a date and has a date format.
So if I enter today's date in cell P7, Q7 should show 0, If I enter
11/16/2009 in cell P7, Q7 should show 1…etc. down the column.


The problem is that this sheet is used by multiple people and they
often get rid of this simple code. So what happens is I have to come
in and update the code every single time!! I don't want to have to
lock this column because of other issues. As a result, I have decided
that a VBA worksheet change event or selection will be best.


So how can I create a VBA worksheet code that will automatically
populate this formula in column Q as data is enter in column P?


Example:


If both columns P & Q are blank, and data are been entered in other
columns, then nothing should happen.
If data is entered in P2, then the worksheet VBA code should auto
populate the code (explained above) into Q2, but nothing in the
other
columns below it…., so they can stay blank.
If data is entered in P3, then the worksheet VBA code should auto
populate the code (explained above) into Q3, but nothing in the other
columns below…, so they can stay blank.
…ect.


I thank you for your patience and assistance!