MrExcel Message Board

Go Back   MrExcel Message Board > Question Forums > Excel Questions

Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only.

Reply
 
Thread Tools Display Modes
Old May 13th, 2002, 02:19 PM   #1
phillyfilms
New Member
 
Join Date: May 2002
Posts: 5
Default

Many thanks to Nimrod for this code. Works like a champ.

Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)

' mirror values between colA & colB
If Target.Column = 1 Then Cells(Target.Row, 2).Value = Target
If Target.Column = 2 Then Cells(Target.Row, 1).Value = Target

End Sub


Now I want to take it a step further, to be able to specify which two cells to mirror.
I'm not having much success. Any ideas would be greatly appreciated.
phillyfilms is offline   Reply With Quote
Old May 13th, 2002, 02:31 PM   #2
Chris Davison
MrExcel MVP
 
Join Date: Feb 2002
Location: Millbank, London, UK
Posts: 1,790
Default

http://www.mrexcel.com/board/viewtop...c=7923&forum=2

http://www.mrexcel.com/board/viewtop...c=7858&forum=2

there's no need to start seperate threads for a related question

this is now the third

stick to your original thread if possible
Chris Davison is offline   Reply With Quote
Old May 13th, 2002, 02:40 PM   #3
Nimrod
MrExcel MVP
 
Join Date: Apr 2002
Location: Vancouver BC , Canada
Posts: 6,259
Default

Hi Philly
Just change the numbers in the code if you want to change the two rows to evaluate.
for example if you want it to be rows 3 and 6 Then:
Code:
Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range) 

' mirror values between colA & colB 
If Target.Column = 3 Then Cells(Target.Row, 6).Value = Target 
If Target.Column = 6 Then Cells(Target.Row, 3).Value = Target 

End Sub
Nimrod is offline   Reply With Quote
Old May 13th, 2002, 02:54 PM   #4
phillyfilms
New Member
 
Join Date: May 2002
Posts: 5
Default

Hi Nimrod

Thanks again for your help. I guess I didn't ask the follow up the right way. What I'm trying to do is to mirror two specific cells, not two entire rows or columns. Example, mirror cells D22 and J13.

Thanks!

phillyfilms is offline   Reply With Quote
Old May 13th, 2002, 02:55 PM   #5
Nimrod
MrExcel MVP
 
Join Date: Apr 2002
Location: Vancouver BC , Canada
Posts: 6,259
Default

Here's a fun little deviation for you !

Code:
Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)
' mirror values between Odd & Even Cols
    If (Target.Column Mod 2) = 0 Then
        Cells(Target.Row, Target.Column - 1).Value = Target
    Else
        Cells(Target.Row, Target.Column + 1).Value = Target
    End If
End Sub
It will mirror odd cells with even and vica versa. ie A1 = B2, C1 = C2 etc
Nimrod is offline   Reply With Quote
Old May 13th, 2002, 03:05 PM   #6
Nimrod
MrExcel MVP
 
Join Date: Apr 2002
Location: Vancouver BC , Canada
Posts: 6,259
Default

Mirror D22 and J13
Code:
Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)
    
    ' mirror values between D22 and J13
    If (Target.Column = 4) And (Target.Row = 22) Then Cells(13, 10).Value = Target
    If (Target.Column = 10) And (Target.Row = 13) Then Cells(22, 4).Value = Target

End Sub
Nimrod is offline   Reply With Quote
Old May 13th, 2002, 03:19 PM   #7
phillyfilms
New Member
 
Join Date: May 2002
Posts: 5
Default

Hi Nimrod,

You're the man! Works great. I like the even odd variant too! LOL

Thanks!!!
phillyfilms is offline   Reply With Quote
Old May 13th, 2002, 03:28 PM   #8
Nimrod
MrExcel MVP
 
Join Date: Apr 2002
Location: Vancouver BC , Canada
Posts: 6,259
Default

Cheers Philly ... it's been fun
__________________

<MARQUEE>...........Never be afraid to try something new. Remember, amateurs built the ark, professionals built the Titanic...............The easiest thing to find is fault, don't be easy !.. --Anonymous--...</marquee>
Nimrod is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On

Forum Jump


All times are GMT -4. The time now is 02:22 PM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2012, vBulletin Solutions, Inc.
All contents Copyright 1998-2012 by MrExcel Consulting.
diabetic desserts recipes recipes Diabetic Soups Holiday Pizza Recipes Popcorn Recipes Recipes For Microwave Pasta Recipes Casserole Recipes Chili Recipes Curry Recipes Crockpot Recipes Apples Recipes Bread Recipes Vegetarian Recipes Vegetable recipes Desserts Recipes Appetizers Ethnic Recipes Meat Dishes Barbecue Recipes Sauces Recipes Marinade Recipes Low Fat Recipes Frugal Gourmet Kitchen Classics Recipes On The Grill Cook Books Seafood Recipes Cajun Recipes Breads Low Fat Low Fat Breads Bread Machine Recipes Yeast Breads Quick Breads Fat Free Vegetarian Salad Recipes Eggplant Recipes Radish Recipes Tomato Recipes Jalapeno Recipes Potato Recipes Lettuce Recipes Cabbage Recipes Beans Ambrosia Recipes Biscotti Recipes Desserts Low Fat Cookie Recipes Cheesecake Recipes Cake Recipes Pie Recipes Muffin Recipes Custard Recipes Best Appetizers Appetizers Low Fat Salsa Recipes Dip Recipes International Recipes Afghan Recipes Alaska Recipes French Recipes German Recipes Greek Recipes Italian Recipes Spanish Recipes Thai Recipes Korean Recipes Chinese Recipes Mexican Recipes Indian Recipes Beef Recipes Pork Pork & Ham Pork Butts Pork Chop Recipes Pork Ribs Rulled Pork Poultry Recipes Stews Recipes Ground Beef Barbecue Grill Barbecue Smoker All Purpose Sauce BBQ Sauce Barbecue Sauce Carolina BBQ Sauce Pickle Recipes Marinades Smoking Low Fat Appetizers & Dips Low Fat Breakfast Low Fat Cakes Low Fat Cheesecakes Low Fat Cookies Low Fat Desserts Low Fat Fish & Seafood Low Fat Meats Low Fat Pasta Low Fat Pies Low Fat Salads Low Fat Sandwiches Low Fat Sauces & Condiments Low Fat Sides Low Fat Soups Low Fat Vegetarian Baker's Dozen Taste of Home Recipe Book Bon Appetit Cookbook Blacktie Cookbook Buster Cook Book Cookbook USA Cook Book Cook Book Sara's Cookbook Sara's Cookbook Appetizers and Dips Poultry recipes Diabetic recipes Holiday recipes Miscellaneous recipes 110 recipes 1986 Usenet cookbook 2900 recipes Cyberrealm recipes Great sysops of world Specialty recipes Ceideburg recipes Cheese recipes Chili recipes Fruits recipes Garlic recipes Great chefs of NY Londontowne recipes Raisins recipes Recipes for kids US Food Vegetarian recipes Bread recipes Drinks Meat Dishes Brisket recipes Caribou recipes Chicken recipes Filet mignons recipes Pork recipes Swordfish recipes Turkey recipes Pasta recipes Uncategorized recipes Ethnic recipes Canada recipes English recipes Ethiopia recipes Germany recipes Greece recipes Mexican recipes Philippines recipes Welsh recipes Microwave recipes Soups recipes Vegetable recipes Asparagus recipes Barley recipes Brown rice recipes Lentil recipes Mushrooms recipes Salads recipes Wild rice Desserts recipes Cakes recipes Chocolate recipes Cookies recipes Ice cream recipes