Changing values in column 1 and 2 based on values in col 3 & 7

S

sonali

I am trying to create micro with requirements as below -

1. cell(2,3) gets focus and if cell(2,1) and cell(2,2) are blank, macro
should put 1 in both.
2. Cell of Any other row (2 onwards) in column 3 gets foucs, cell(row,1)
should copy value of prevois row and cell(row,2) should have incremented
value than previous row.
3. If any cell from col 7 is focuesd and cell(row,3) is bank then
cell(row,3) = cell(row-1,2) and cell(row,1) = cell(row-1,col).

I am using workbook_change event to active above mentioned logic, but is not
working correctly as this event does not get fired while entering values in
the cell for first time. Also sometime application is in infinite loop.
What is the correct way to implement above requirements.
 
T

Tim Williams

It would help to show your existing code. To avoid infinite loops when
changing the sheet from within the _change procedure:

Application.EnableEvents = False
'make change to sheet
Application.EnableEvents = True

Be sure to have error-handling code to reset the application events in case
of any error: otherwise this setting will persist even when your macro has
completed.

Tim
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top