ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Changing values in column 1 and 2 based on values in col 3 & 7 (https://www.excelbanter.com/excel-programming/410138-changing-values-column-1-2-based-values-col-3-7-a.html)

sonali

Changing values in column 1 and 2 based on values in col 3 & 7
 
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.



Tim Williams

Changing values in column 1 and 2 based on values in col 3 & 7
 
It would help to show your existing code. To avoid infinite loops when
changing the sheet from within the _change procedu

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

"sonali" wrote in message
...
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.






All times are GMT +1. The time now is 01:43 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com