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 17th, 2002, 02:25 AM   #1
p please bob
New Member
 
Join Date: May 2002
Posts: 19
Default

I am trying to format a cell (place solid outline around it) if another cell in that row isn't blank. However the column of possibly filled cells varies from worksheet to worksheet.
This is driving me so nuts I can't explain it properly either. all help gratefully rec'd
p please bob is offline   Reply With Quote
Old May 17th, 2002, 02:33 AM   #2
walding
New Member
 
Join Date: May 2002
Posts: 34
Default

Do the columns of "possibly filled cells" have anything in common (e.g. header at the top, value if filled) that is exclusive to those columns?

It's difficult to visualise what you are trying to do.

Andrew
walding is offline   Reply With Quote
Old May 17th, 2002, 02:38 AM   #3
p please bob
New Member
 
Join Date: May 2002
Posts: 19
Default

I have sub totalled a range of information, where the **** total appears in a row, say cell D5 - I want to format cell J5 with a solid outline.
p please bob is offline   Reply With Quote
Old May 17th, 2002, 02:54 AM   #4
walding
New Member
 
Join Date: May 2002
Posts: 34
Default

Conditional formatting won't work, as far as I know.


It can be done with a macro, but that would either mean running the macro on an event (e.g. every time you change cell selection - this could be limited to checking just that row) or doing the check manually (e.g. press a button).
How this is scripted depends on how you want it to function.

walding is offline   Reply With Quote
Old May 17th, 2002, 03:02 AM   #5
p please bob
New Member
 
Join Date: May 2002
Posts: 19
Default

The info changes daily, it is sorted and then printed, the formatted cells give a 'tick box' on the hard copy, so a macro would probably be ok, but I don't know where to start.
p please bob is offline   Reply With Quote
Old May 17th, 2002, 03:18 AM   #6
walding
New Member
 
Join Date: May 2002
Posts: 34
Default

This will need editing to suit your needs.
Try it and see what changes you want. If you need more help, just ask.


Sub format()

' Declare Variables
Dim cellToFormat
Dim cellToCheck
Dim columnToFormat
Dim columnToCheck
Dim rowNumber

'Set Column to Format
columnToFormat = "J"

'Set Column to Check
columnToCheck = "D"

'Set Number of Rows to Format
rowNumber = 1000

' For loop to check D column and format J column
For i = 1 To rowNumber

cellToCheck = columnToCheck & i

If Not (Range(cellToCheck).Value = "") Then
cellToFormat = columnToFormat & i
With Range(cellToFormat).Borders(xlEdgeLeft)
End With
With Range(cellToFormat).Borders(xlEdgeTop)
End With
With Range(cellToFormat).Borders(xlEdgeBottom)
End With
With Range(cellToFormat).Borders(xlEdgeRight)
End With
End If

Next i


End Sub
walding is offline   Reply With Quote
Old May 17th, 2002, 03:26 AM   #7
walding
New Member
 
Join Date: May 2002
Posts: 34
Default

Apologies - missed out the weighting of the borders:

.Weight = xlThin
or

.Weight = xlThick

This line goes directly under each border setting:

With Range(cellToFormat).Borders(xlEdgeLeft)
.Weight = xlThin
walding is offline   Reply With Quote
Old May 17th, 2002, 05:54 AM   #8
p please bob
New Member
 
Join Date: May 2002
Posts: 19
Default

Thanks very much, I'll try it out and let you know when I get back to work.

I wish I'd asked here first !!
p please bob is offline   Reply With Quote
Old May 17th, 2002, 06:04 AM   #9
Ian Mac
MrExcel MVP
 
Join Date: Feb 2002
Location: Newcastle, UK
Posts: 1,174
Default

Quote:
On 2002-05-17 01:54, walding wrote:
Conditional formatting won't work, as far as I know.


It can be done with a macro, but that would either mean running the macro on an event (e.g. every time you change cell selection - this could be limited to checking just that row) or doing the check manually (e.g. press a button).
How this is scripted depends on how you want it to function.

Why wil conditional formatin not Work??

from your code it looks like:

in column J 1-1000

Conditional Formating>Formula is =ISNUMBER($D1)

should be the same.

With regards to the orignal question.
Is the formatting only to be done in the row with a SUBTOTAL with other numbers above?
__________________
"Have a good time......all the time"
Ian Mac
Ian Mac is offline   Reply With Quote
Old May 17th, 2002, 06:42 AM   #10
walding
New Member
 
Join Date: May 2002
Posts: 34
Default

Quote:
On 2002-05-17 05:04, Ian Mac wrote:

Why wil conditional formatin not Work??

from your code it looks like:

in column J 1-1000

Conditional Formating>Formula is =ISNUMBER($D1)

should be the same.

I don't know why it won't work - I just can't get it to work! Let me know if you manage, and how you did it - I've tried without success.

Cheers

Andrew
walding 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:04 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