Flux rss
Search : in
By : Relevance Date Username
Statut : Not resolved

Simple If else Loop with hide row

Ninong, on Thursday 25 September 2008 à 12:19:42
Hello,

I'm making a spreadsheet where in I want to hide those rows when the cell in column d is not equal to the value in cell b1.

I just do not know what the statements for the macro should be, since i do not know anything in VB but I think here is what I want to happen..

*b1 is a selection of categories(variable)
*range of list is A3:L450
*column a is the list of items
*column c indicates what is the category of the item

go to c3

if current cell=b1 then go to the next row(same column)
else hide the current row then go to the next row(same column)

repeat this if statements while current cell is <=c450
Reply to Ninong  Report this message to moderators Go to last message

1


  • 1
    This message seems useful, vote!
  • Ce message ne vous semble pas utile, votez !
  • Report this message to moderators
 Ivan-hoe, on Friday 26 September 2008 à 07:55:02
Hello,
here is a solution in a kit form. Dare ask if you need more help.
Ivan

Use a "For Each...Next" loop :
Dim MyCell As Range, MyRange As Range
    Set MyRange = Range("C3:C450")
    For Each MyCell In MyRange
        'instructions
    Next MyCell

The "if" statement would be :
If MyCell.Value <> Range("B1").Value Then
    'instructions
End If

Then, to hide a row, have a look at "Range.EntireRow" and "Range.Hidden" in the help file.

To make your code run faster, think of using "Application.ScreenUpdating" (see help file)

If you want your macro to run automatically when you change the selection in B1, see the help file about the events of a worksheet.
Reply to Ivan-hoe

Résultats pour Simple If else Loop with hide row

Permantly hiding a column in Excel Hello, I have an .xls sheet to email to a client and I do not want him to see one column - which containes my profit margin. I can hide this, but once emailed he can simply unhide the column and view. Is there any way that I can hide the column... en.kioskea.net/forum/affich-13594-permantly-hiding-a-column-in-excel
Excel: alphanumeric if then statements Hello, I am setting up a database template for people who are not Excel trained and I am attempting to make the input easy for the users as well as myself when I begin analyzing the data. I am trying to an if-then statement or create a macro (I know... en.kioskea.net/forum/affich-8721-excel-alphanumeric-if-then-statements
Need help in Excel Macro (Solved) Hello Ivan, Ive' been reading a lot of your answers and i'm quite facinated of your skill. I need to create a macro for one of my project and it involves tranferring data (row) to specific range in another work sheet. I tried to produce a... en.kioskea.net/forum/affich-17266-need-help-in-excel-macro

Résultats pour Simple If else Loop with hide row

To see the content of a .jar file.To see the content of a .jar file. A simple method to see the content of a .jar file: firstly rename it in .zip file and open it. If you want to see the content of java programs compiled in .class, you must use a Java decompiler like JAD: (a... en.kioskea.net/faq/sujet-556-to-see-the-content-of-a-jar-file
How to hack an MSN accountHow to hack an MSN account Several websites now propose simple solutions to hack another messenger account for free. Some state that if you provide them with the email of the victim together with your email and password, your victim’s... en.kioskea.net/faq/sujet-154-how-to-hack-an-msn-account
How to count number of words in MS Words sheet!How to count number of words in MS Words sheet! It is quite simple to count the number of words in a Microsoft word sheet. This tip might be very useful for example, if you wish to make a presentation on Microsoft word for an approximate number... en.kioskea.net/faq/sujet-354-how-to-count-number-of-words-in-ms-words-sheet

Résultats pour Simple If else Loop with hide row

Excel Custom FunctionHello, i have created a custom excel function which works fine. the only problem being, you need to press F2 on the custom formula cell and give enter to refresh the formula. is there any way to refresh the formula every time the workbook is opened or... en.kioskea.net/forum/affich-24381-excel-custom-function
Hide img if src invalidHello, Currently in IE, and other browsers handle it similar, an "X" image comes up if I have an an img tag, with a src URL the browser can't resolve. I want to have the image simply hidden if that happens, and nothing displayed. How can this be... en.kioskea.net/forum/affich-1849-hide-img-if-src-invalid
Hide img if src invalidHello, Currently in IE, and other browsers handle it similar, an "X" image comes up if I have an an img tag, with a src URL the browser can't resolve. I want to have the image simply hidden if that happens, and nothing displayed. How can this be... en.kioskea.net/forum/affich-1684-hide-img-if-src-invalid

Résultats pour Simple If else Loop with hide row

Download LoopBe1LoopBe1 is a software which serves for transferring data MIDI from a program to the other one thanks to your internal equipment. In reality, it's as if the sound MIDI produced by an application is acquired by another application as source.Program can... en.kioskea.net/telecharger/telecharger-818-loopbe1
Download SimpleOCRIf they have a scanner and documents (newspapers, pounds), they are not any more made to make grab these documents to acquire required information. Scanner these documents and then is simply necessary to translate them into text while keeping the... en.kioskea.net/telecharger/telecharger-365-simpleocr
Download Vista Live Shell Pack - PinkIf you want to have Vista on your computer but your shape is not rather powerful or if simply you cannot have to be paid this version yet? Then resolution is to change the appearance of your good old XP. Vista Live Shell Pack is a topic of office... en.kioskea.net/telecharger/telecharger-771-vista-live-shell-pack-pink

Résultats pour Simple If else Loop with hide row

Zombies and botnets: OECD warns of hidden armies in cyber warsAnti-virus software on sale in Miami, Florida. The simple act of using a computer for email or the Internet can mobilise armies of hidden agents and criminals out to subvert the system and business, the OECD says in a study on cyber crime. The simple... en.kioskea.net/actualites/zombies-and-botnets-oecd-warns-of-hidden-armies-in-cyber-wars-10421-actualite.php3

Résultats pour Simple If else Loop with hide row

Network tools - Ping "Ping" (short for Packet INternet Groper) is without a doubt the best-known network administration tool. It is one of the simplest tools, because all it does is send packets to check if a remote machine is responding and, by extension, if it is... en.kioskea.net/outils-reseau/ping.php3
Kioskea - Terms of Use - Advice for Writing Messages Before starting a new thread, it is recommended to use the search engine to see if a similar problem has already been discussed. If it has, and the thread only answers part of your question, simply reply to that thread. The discussion will be... en.kioskea.net/ccmguide/ccmcharte-ecriture.php3