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 Apr 9th, 2002, 03:19 AM   #1
andonny
 
Join Date: Mar 2002
Posts: 217
Default

Hi,
I would like to stop anybody to enter anything into B1 if A1 does not have anything in it. If A1 has an entry then I should be able to enter data into B1.

How do I achieve this.

Thanks for your help in advance
Andonny
andonny is offline   Reply With Quote
Old Apr 9th, 2002, 03:36 AM   #2
Qroozn
 
Join Date: Mar 2002
Location: Sydney/Brisbane , Australia
Posts: 539
Default

why do you want to do it?
can you run a macro at the end that says if a cell i blank that put in a certain value?
Qroozn is offline   Reply With Quote
Old Apr 9th, 2002, 03:38 AM   #3
Derek
 
Join Date: Feb 2002
Location: Perth Australia
Posts: 1,564
Default

Hi there

Use a custom validation with this formula=OFFSET(B1,0,-1)<>""

Put this in the Error Alert
"Entry is only allowed when A1 is not blank"
Regards
Derek
Derek is offline   Reply With Quote
Old Apr 9th, 2002, 03:44 AM   #4
andonny
 
Join Date: Mar 2002
Posts: 217
Default

Hi,
I am not too sure where and how to put the alert

Thanks a million
Andonny
andonny is offline   Reply With Quote
Old Apr 9th, 2002, 03:49 AM   #5
Brian from Maui
 
Brian from Maui's Avatar
 
Join Date: Feb 2002
Posts: 7,617
Default

From the Data Validation window, click on the Error Alert tab
Brian from Maui is offline   Reply With Quote
Old Apr 9th, 2002, 04:33 AM   #6
andonny
 
Join Date: Mar 2002
Posts: 217
Default

Hi,
Great this works perfectly. Is it also possible to stop an entry all together. This way it is still possible to make an entry if the alert is ignored. I am happy with this solution but just in case somebody wants to take it a step further.

That would be down the the whole column B.

Your help is very much appreciated
Andonny
andonny is offline   Reply With Quote
Old Apr 9th, 2002, 06:45 AM   #7
Derek
 
Join Date: Feb 2002
Location: Perth Australia
Posts: 1,564
Default

Hi again
In data validation, on the ERROR ALERT tab you need a tick in the box against "Show error alert after invalid data is entered" and in the Style drop down box you need to select STOP. This will prevent an entry succeeding.

With data validatiion already in B1 just select column B, go to data validation and go OK to extending the validation to other cells.

Be aware, however, that validation is a type of cell formatting and that it can be circumvented by copying a non-validated cell and pasting it over your validated cell.

regards
Derek
Derek is offline   Reply With Quote
Old Apr 9th, 2002, 07:09 AM   #8
Derek
 
Join Date: Feb 2002
Location: Perth Australia
Posts: 1,564
Default

Andonny

An alternative to data validation is an event macro.

Right click your sheet name tab, left click View Code and paste this code into the white area. Use Alt+F11 to return to your sheet.

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
On Error Resume Next
If Target.Column = 2 Then
If Target.Offset(0, -1) = "" Then
MsgBox "You cannot enter data in Column B if the cell in Column A is blank"
Target.Offset(0, 1).Select
End If
End If
End Sub

You will get fewer unnecessary messages if you also go to Tools, Options, Edit and change the setting of "Move selection after Entry" so that the Direction is Right (rather than Down)

Good Luck
Derek
Derek 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 +1. The time now is 11:10 PM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
All contents Copyright 1998-2009 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