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 1st, 2002, 05:35 AM   #1
duckfoot
New Member
 
Join Date: Apr 2002
Posts: 22
Default

Is it possible to run a macro as the result of an IF function?

i.e.
IF(logical_test,value_if_true,RUN MACRO1)

thanks
duckfoot is offline   Reply With Quote
Old May 1st, 2002, 05:41 AM   #2
s-o-s
Board Regular
 
s-o-s's Avatar
 
Join Date: Apr 2002
Location: Kissimmee, Florida
Posts: 384
Default

Quote:
On 2002-05-01 04:35, duckfoot wrote:
Is it possible to run a macro as the result of an IF function?

i.e.
IF(logical_test,value_if_true,RUN MACRO1)

thanks
If you have created a UDF(User Defined Function) then yes.

It does not matter that Excel Already has this function just create a unique name

eg
Function My_If(Cells or Ranges to do test on)

If TestTrue then Call Macro1

End Function

If this is not specific enough Give me some more info.
__________________
Hope This Helps.
Sean.
Digest of Homes

WinXP, XL XP
s-o-s is offline   Reply With Quote
Old May 1st, 2002, 05:51 AM   #3
duckfoot
New Member
 
Join Date: Apr 2002
Posts: 22
Default

i'm not entirely sure what you mean so i'll give you some more detail if thats ok:

this is the simple formula i'm using and the macro, when run, simply draws a thick line under several cells.

=IF(RC[1]="",RC[1],macro1)
duckfoot is offline   Reply With Quote
Old May 1st, 2002, 06:12 AM   #4
duckfoot
New Member
 
Join Date: Apr 2002
Posts: 22
Default

in fact, that makes no sense to me whatsoever...

i don't know how to use a UDF and really need to know how i "call macro1"
or how i write: "run macro1" in the function.
duckfoot is offline   Reply With Quote
Old May 1st, 2002, 06:21 AM   #5
s-o-s
Board Regular
 
s-o-s's Avatar
 
Join Date: Apr 2002
Location: Kissimmee, Florida
Posts: 384
Default

It sounds like Conditional Formating may be what your looking for...

Select the 1st cell for the Test

Lets say it is Cell C3

Format/Conditional Formatting

In the first drop down change to show Formula is

In the next box enter

=isblank(C3)

Next click the format box and choose underline (This does not stand out so well as you cannot add think...you could also add a Gold background at the same time)
Click OK

Copy the formats to all the cells that you want testing. If the cell is Blank you will see Golden highlighted cells with underline.

Let me know if this does not solve you problem as this is much easier to do than the VB will be(especially if you are not too familiar with it).

__________________
Hope This Helps.
Sean.
Digest of Homes

WinXP, XL XP
s-o-s is offline   Reply With Quote
Old May 1st, 2002, 06:31 AM   #6
duckfoot
New Member
 
Join Date: Apr 2002
Posts: 22
Default

ok ok... i've tried that and its not really working.
Imagine i have column A filled irregularly with values and with blank cells inbetween these. I need a thick line passing along the top of only the filled cells and across to column E.
I need to do this rapidly down the column for several thousand rows.
Really appreciate you taking the time to help
Thanks!
duckfoot is offline   Reply With Quote
Old May 1st, 2002, 06:49 AM   #7
s-o-s
Board Regular
 
s-o-s's Avatar
 
Join Date: Apr 2002
Location: Kissimmee, Florida
Posts: 384
Default

Quote:
On 2002-05-01 05:31, duckfoot wrote:
ok ok... i've tried that and its not really working.
Imagine i have column A filled irregularly with values and with blank cells inbetween these. I need a thick line passing along the top of only the filled cells and across to column E.
I need to do this rapidly down the column for several thousand rows.
Really appreciate you taking the time to help
Thanks!
Can I try one more go at the conditional formatting as It will be much faster for you.

Select Columns A-E
Enter Conditional Formatting
In the box do formula is

=ISBLANK($A1)

Set formatting to Black line (And Gold? as it won't do a thick line)

Click OK.

This will give you instantly the whole spreadsheet highlighted in rows A-E where column A is blank.

If this still doesn't help let me know.

I should really be getting on with my day job soon though so I will give you the code tonight.
__________________
Hope This Helps.
Sean.
Digest of Homes

WinXP, XL XP
s-o-s is offline   Reply With Quote
Old May 1st, 2002, 08:17 AM   #8
duckfoot
New Member
 
Join Date: Apr 2002
Posts: 22
Default

nope - sorry, but it really isn't happening for me...
I'm keen on this change event idea but don't know how to apply it to my problem. This is a link to an explanation to the same query:

http://www.cpearson.com/excel/excelM.htm#RunFromCell

but i don't know how to apply it to my problem.
cheers
duckfoot is offline   Reply With Quote
Old May 1st, 2002, 10:23 AM   #9
s-o-s
Board Regular
 
s-o-s's Avatar
 
Join Date: Apr 2002
Location: Kissimmee, Florida
Posts: 384
Default

OK I have now got the macros working.

I will use the change events...Drop me your email by Private message if you prefer and I'll send it out. (it will take 2-3) hours from now before I get to my home email though...

Anyone else interested drop me a line

If too many I'll post it on the web.

__________________
Hope This Helps.
Sean.
Digest of Homes

WinXP, XL XP
s-o-s is offline   Reply With Quote
Old May 1st, 2002, 02:37 PM   #10
s-o-s
Board Regular
 
s-o-s's Avatar
 
Join Date: Apr 2002
Location: Kissimmee, Florida
Posts: 384
Default

As promised... I have returned with the solution.

This link takes you to the file which you should save to your hard disk and then open from Excel directly...It will not perform correctly from the Web Page view of Excel.

http://<font color="blue">S-O-S File...derline blanks

Hope This Helps

__________________
Hope This Helps.
Sean.
Digest of Homes

WinXP, XL XP
s-o-s 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 05:34 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