Swap value of two cells when required, based on pre-defined criteria

Tim Ng

New Member
Joined
Jan 11, 2014
Messages
8
Hello, I would like to ask if any vba function is available to perform the captioned function.
To illustrate what is to be achieved, below is the sample data:

Cell A1: 43
Cell A2: 31

When the above is input by the user, the below events are required:
1. Notification message pop-up and advise the user that the value of cell A2 should always larger or equal to A1, and;
2. Automatically swap the value of cell A1 and A2

The above should not be performed when only one of the cell (either A1 or A2) has value input (as this should be the case that the user is still on the way to fill in both values), or if value in cell A2 is already higher than A1 right after user input.

Many thanks for any help on the above. Cheers~! :LOL:
 

Excel Facts

Excel Joke
Why can't spreadsheets drive cars? They crash too often!
Have you tried looking at Data Validation for this? Set up properly, it will not allow A2 to be smaller than A1
 
Upvote 0
Have you tried looking at Data Validation for this? Set up properly, it will not allow A2 to be smaller than A1

Hi FDibbins, thanks for the advice.

Yes data validation does part of the requirement, but just wonder if any use of vba programme can handle the data swapping thus user does not need to revise the entries by themselves...:ROFLMAO:
 
Upvote 0

Forum statistics

Threads
1,214,377
Messages
6,119,182
Members
448,872
Latest member
lcaw

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top