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 2nd, 2002, 01:10 PM   #1
ROAST
New Member
 
Join Date: Apr 2002
Posts: 21
Default

HOW DO I USE A MACRO THAT WILL LOOK AT COLUMN "A" IN MY WORK SHEET AND HIDE THE ROWS MARKED "HIDE"?.

[ This Message was edited by: ROAST on 2002-04-02 12:11 ]
ROAST is offline   Reply With Quote
Old Apr 2nd, 2002, 01:21 PM   #2
Ricky Morris
Board Regular
 
Join Date: Mar 2002
Posts: 363
Default

Sub HideRows()
Dim cell As Range
For Each cell In Range("A:A")
If cell.Value = "HIDE" Then
cell.EntireRow.Hidden = True
End If
Next
End Sub
__________________
It's never too late to learn something new.

Ricky
Ricky Morris is offline   Reply With Quote
Old Apr 2nd, 2002, 01:36 PM   #3
Jack in the UK
Board Regular
 
Join Date: Feb 2002
Posts: 3,065
Default

Hi

Very rare i post VBA buit this is cool, conditional fromat will also work just by adding conditions.. super coll code.. i use this a lot..

One to go arround the world....

////////
Sub Hide_Rows()
On Error GoTo Z
Sheets("Sheet1").Select
Range("A1:A10000").Select 'Jack sets range amend as needed
Selection.Interior.ColorIndex = xlNone
Range("A1").Select
Application.ScreenUpdating = False
Rw = 1
With Sheets("Sheet1") 'Jack in the UK
For Hide1 = _
1 To WorksheetFunction.CountIf(.Columns("A:A"), "HIDE")
Set RHIDEFoundCell = .Columns("A:A").Find(What:="HIDE", _
After:=.Cells(Rw, 1))
RHIDEFoundCell.EntireRow.Hidden = True
Rw = RHIDEFoundCell.Row
Next Hide1
End With
Range("A1").Select
Application.ScreenUpdating = True
Z:
End Sub

//////////////////

__________________
Free Excel based Web Toolbar available here.

Jack in the UK
J & R Excel Solutions
"making Excel work for you"
Jack in the UK is offline   Reply With Quote
Old Apr 2nd, 2002, 02:06 PM   #4
Chris Davison
MrExcel MVP
 
Join Date: Feb 2002
Location: Millbank, London, UK
Posts: 1,790
Default

conditional format Jack ?

do share mate
Chris Davison is offline   Reply With Quote
Old Apr 2nd, 2002, 02:48 PM   #5
Jack in the UK
Board Regular
 
Join Date: Feb 2002
Posts: 3,065
Default

Hi All

I dont post VBA very often either i get ripped appart or someione postes over me, so i dont share but this code i have developed and it super cool. IF you get used to it and work its way, other VBAers will have their method im sure.

BUT.. im a simple south london boys who say @WHY CANT I DO x y Z D F D fvsfjvhsfj all at the same time and bolt on as many as i like, thjis code does this...

OK this is the trick:

........
Sub Hide_Rows() ;
' Jack called this Hide rows as that was the question in real life its called Jacks_Conditions
On Error GoTo Z
' Jack places error handle
Sheets("Sheet1").Select ;
' Jack select sheet can be any one or and in that workbook... COOL!
Range("A1:A10000").Select
'Jack sets range amend as needed (normal Table format so muct be some coumumn...
Selection.Interior.ColorIndex = xlNone
'Jack distroys all the colours.. i use colours a lot IE if in Col A a row says REFER to Chris D then that important so mioght go red in all column... Highlight it//
Range("A1").Select
'Jack selects cell !,1 or A1 same thing
Application.ScreenUpdating = False
' Jacks stops flickering...
Rw = 1 ;
' Jack set Rw to = 1 good place to start again can be any numnber depending of what you want (will always be 1 i add)
With Sheets("Sheet1")
'Jack in the UK select to alter sheet 1 ie with command
For Hide1 = _
1 To WorksheetFunction.CountIf(.Columns("A:A"), "HIDE")
' Jack cheat again uses APPLICATION FUNCTION ie countif.. this FINDS all X i want to find in ONE HIT,, LOOPS.... Yuuuuck..
Set RHIDEFoundCell = .Columns("A:A").Find(What:="HIDE", _
After:=.Cells(Rw, 1)) :
' Jack set look up and what to find ie HIDE in this case
RHIDEFoundCell.EntireRow.Hidden = True ;
' Jack set command to found data IE HIDE it acan be what ever your heart desires.. i use colour entire row a lot///
Rw = RHIDEFoundCell.Row
; Jack sets Rw to whats been found
Next Hide1
' Jack compleats sneaky loop with next command
End With
;Jack compleasts with command
Range("A1").Select
'Jack select A1 or cell(1,1)
Application.ScreenUpdating = True
' Jack set screen updating to true to make changes happen IE if coloured rows makes them show
Z:
' Jack compleats error handle
End Sub
//// OK that a lot for one condition but add in this....

middle section as many as you like and 3 conditions are blown away.. i have had 26 conditions, wonderful does some 60,000 rows in a few seconds fast enough for me.

BE CAREFUL if Hide is types hide SSPACE wond work muste be Hide exactly...

Does that help///
__________________
Free Excel based Web Toolbar available here.

Jack in the UK
J & R Excel Solutions
"making Excel work for you"
Jack in the UK 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 10:25 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