![]() |
![]() |
|
|||||||
| Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Board Regular
Join Date: May 2002
Posts: 485
|
This forum is a good thing.
I know a genius will solve this problem in no time. Cells E3:E6 are populated with numbers, so too are cells F3:F6. First I want to auto sort the following range B3:F6, sorting by E3:E6 whenever a value in E3:E6 is changed. Second I want to auto sort the following range B3:F6, sorting by F3:F6 whenever a value in F3:F6 is changed. Then, I want to do this: Using macro (or any other way possible), determine if E3>E4 and if so, place D3 in cell H3 and D4 in cell H4. If E3=E4, then determine if F3>F4 and if so then place D3 in H3 & D4 in H4. If F3 That's it! I hope this is not too crazy. Thanks in advance. |
|
|
|
|
|
#2 | |
|
MrExcel MVP
Join Date: Mar 2002
Location: Michigan USA
Posts: 11,452
|
Quote:
solution 2) for the seconfd part, try the following formulas in cell H3 ... =IF($E$3>$E$4,D3,IF($E$3=$E$4,IF($F$3>$F$4,D3,"whateverElse"))) in cell H4 ... =IF($E$3>$E$4,D4,IF($E$3=$E$4,IF($F$3>$F$4,D4,"whateverElse"))) I am sure these can be simplified, but this will get you started.
__________________
Regards! Yogi Anand, D.Eng, P.E. Energy Efficient Building Network LLC www.energyefficientbuild.com |
|
|
|
|
|
|
#3 |
|
Board Regular
Join Date: May 2002
Posts: 485
|
Thanks man. I'm willing to give it a shot. Let's see if someone else can give me some more ideas.
|
|
|
|
|
|
#4 |
|
Legend
Join Date: Feb 2002
Location: Minneapolis, Mn, USA
Posts: 9,704
|
I tried to crank the whole nine yards in vba. Right click on the sheet tab in question, click 'view code' and paste the following:
This does a sort, in ascending order, not sure which way you wanted to go, but if need be (much like my poor dog) it can be fixed. _________________ Cheers, NateO ![]() [ This Message was edited by: nateo on 2002-05-13 19:19 ] |
|
|
|
|
|
#5 |
|
Join Date: May 2002
Posts: 73
|
You see. It didn't need any geniuses.
|
|
|
|
|
|
#6 |
|
Board Regular
Join Date: May 2002
Posts: 485
|
You're all geniuses.
By the way NateO, I place the code in as you suggested but I cannot get it to work. Is there something else that I need to do? Even when the cell values change nothing happens. Sorry for the trouble. |
|
|
|
|
|
#7 | |
|
Join Date: May 2002
Posts: 73
|
Quote:
|
|
|
|
|
|
|
#8 |
|
Legend
Join Date: Feb 2002
Location: Minneapolis, Mn, USA
Posts: 9,704
|
No trouble. You did indeed get the code in the correct sheet module as described above (Right click on the sheet tab (sheet with data), click 'view code' and paste the following)....Perhaps your events aren't enabled. Put the following in any normal module, run it and try again:
Code:
sub ck() application.enableevents = true end sub _________________ Cheers, NateO ![]() [ This Message was edited by: NateO on 2002-05-13 18:25 ] |
|
|
|
|
|
#9 |
|
Board Regular
Join Date: May 2002
Posts: 485
|
Call me stupid, but I just can't get this thing to work. I did everything you said...then I realize the problem:
The macro is running but only if I change the value in the cell by clicking on the cell and entering new values. That's not what I'm doing. The value in the cells are actually changing when I change the values in cells on a totally different sheet. I thought the macro would run when the value is changed, nevermind the fact that the change is not done directly. Guess I just don't know this thing. Nateo can you help please? |
|
|
|
|
|
#10 |
|
Legend
Join Date: Feb 2002
Location: Minneapolis, Mn, USA
Posts: 9,704
|
ExcelNovice, did you notice my private message way back when? I'd be more than happy to help. I could show you one of a few ways to accomplish this. If you're still interested, to make this more fruitful, name the worksheet that the entry is made, and the range the entry is made, and the name of the sheet where the data is manipulated.
|
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|