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 30th, 2002, 04:54 AM   #1
abz2max
New Member
 
Join Date: Apr 2002
Posts: 19
Default

i need to know how to make a macro which can check a number of cells to make sure that there is something written in them. this presence check is to make sure the user hasn't forgotten to type the data in the cells.
Thankz
abz2max is offline   Reply With Quote
Old Apr 30th, 2002, 05:54 AM   #2
Robb__
New Member
 
Join Date: Apr 2002
Posts: 41
Default

When do you want to check the input?

What I mean is: what will the user do to trigger the check? You could check all the cells when the user goes to another sheet, but only if you are sure they will. How it would be done depends on what the user is likely (or preferably will) do.

Regards

Robb__
Robb__ is offline   Reply With Quote
Old Apr 30th, 2002, 06:02 AM   #3
abz2max
New Member
 
Join Date: Apr 2002
Posts: 19
Default

I WANT DO DO A PRESENCE CHECK WHEN A BUTTON WITH A MACRO IS PRESSED. HOW DO I DO THIS. THIS BUTTON WILL BE CALLED PRESENCE CHECK.
THANKZ
abz2max is offline   Reply With Quote
Old Apr 30th, 2002, 06:04 AM   #4
Iain Lewis
Board Regular
 
Join Date: Apr 2002
Location: Midlands, UK
Posts: 217
Default

How about this macro :

Sub aaa()
Range("asdf").Select
ran1 = Range("asdf")
mycount = WorksheetFunction.CountA(ran1)
mycount = Selection.Count
If rowcount <> mycount Then
MsgBox ("error")
End If
End Sub

You will need to name the range of cells you're checking ( I've used "asdf" ).
Iain Lewis is offline   Reply With Quote
Old Apr 30th, 2002, 06:22 AM   #5
abz2max
New Member
 
Join Date: Apr 2002
Posts: 19
Default

the formula u gave me dosent work. it always shows the error message when i press the button. was i supossed to put anything between the <>.
abz2max is offline   Reply With Quote
Old Apr 30th, 2002, 06:25 AM   #6
Iain Lewis
Board Regular
 
Join Date: Apr 2002
Location: Midlands, UK
Posts: 217
Default

Sorry - I'd not checked the code properly.

Sub aaa()
Range("ASDF").Select
ran1 = Range("asdf")
mycount = WorksheetFunction.CountA(ran1)
rowcount = Selection.Count
If rowcount <> mycount Then
MsgBox ("error")
End If
End Sub
Iain Lewis is offline   Reply With Quote
Old Apr 30th, 2002, 06:26 AM   #7
Robb__
New Member
 
Join Date: Apr 2002
Posts: 41
Default

I think the variables may be duplicated. Try this slight amendment:

Sub aaa()
Range("asdf").Select
ran1 = Range("asdf")
rowcount = WorksheetFunction.CountA(ran1)
mycount = Selection.Count
If rowcount <> mycount Then
MsgBox ("error")
End If
End Sub

I haven't tested it, but it could be the answer.

Any help?

Regards

Robb__
Robb__ is offline   Reply With Quote
Old Apr 30th, 2002, 06:38 AM   #8
abz2max
New Member
 
Join Date: Apr 2002
Posts: 19
Default

thankz, now it works perfect.
but i need to tell the macro that if all the cells were filled in, then it should now copy and paste the cells to another place. but if it found a cell empty then it shoul only show the erroe message and stop.

thankz
abz2max is offline   Reply With Quote
Old Apr 30th, 2002, 06:51 AM   #9
abz2max
New Member
 
Join Date: Apr 2002
Posts: 19
Default

can u please help me with the last problem.
and now i have another question.
what if the cells that i want to check are not in a list. i.e i wand to check cells
C3,C5,C7 and C9.
abz2max 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 11:15 AM.


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