Log in

View Full Version : VBA for looping cell change



riteoh01
10-27-2011, 05:27 PM
Hi,

Firstly, using Excel 2003.

I have 2 cells - g17 and g19.

I need to write some code that will allow an input into these cells, and after the last input, prompt with a message box whether there are any other inputs required for these cells, and if so, remember the previous values and prompt for new values (of course focussing on cell g17 once again).

I have hardly any experience with VBA - I tend to read code to try and understand what it is doing, and then playing around with it myself - so any help that anybody can provide would be valued.

I believe I have to use a change event for the worksheet?

Thanks.

Kenneth Hobs
10-27-2011, 09:03 PM
Welcome to the forum!

A change event for the G19 cell should be sufficient. Not sure what you mean about remember the previous values. The cells will show the previous values until you overwrite them which changes them and would fire the sheet's Change event.

riteoh01
10-27-2011, 10:37 PM
Welcome to the forum!

A change event for the G19 cell should be sufficient. Not sure what you mean about remember the previous values. The cells will show the previous values until you overwrite them which changes them and would fire the sheet's Change event.

Kenneth,

I want to type a value in cell G17 (remember it for calculations on other sheets), type value in cell G19 (remember it for calculations on other sheets), THEN ask the user whether any more inputs are required for these cells, Yes - loop back to G17, No - continue with the action. Problem being, I don't know where to start!

Thanks for the reply.

Kenneth Hobs
10-28-2011, 05:04 AM
If a cell formula depends on another cell, changing the cell value updates those cells with dependent formulas. I don't see a reason for remember.