![]() |
![]() |
|
|||||||
| Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Guest
Posts: n/a
|
I have a spreadsheet with inventory data in it and I want to selectively hide rows. Essentially, I do not want rows to print that have zero in the quantity column (let's use column 1 in this example).
My thought was to create a macro that would go to A1, test it for zero, hide the row if it is zero, and go down to the next row. It should end when it comes to the word "end" in a cell. Problem is: I don't know how to write Excel macros. Any ideas? Thanks. |
|
|
|
#2 |
|
MrExcel MVP
Join Date: Feb 2002
Location: Winnipeg
Posts: 2,330
|
You don't really need to do this via a macro. Why not use data filtering? From the main menu, select Data|Filter|AutoFilter. You can then specify to show non-zero values. If you need any help with this just let me know.
PS - you should post this question in the "Macro Questions" section since this forum is only for testing. At least that's my understanding
__________________
Barrie Davidson "You're only given a little spark of madness. You mustn't lose it." - Robin Williams |
|
|
|
|
|
#3 | |
|
MrExcel MVP
Join Date: Feb 2002
Location: The Hague
Posts: 50,314
|
Quote:
Aladin [ This Message was edited by: Aladin Akyurek on 2002-02-16 11:42 ] |
|
|
|
|
|
|
#4 |
|
New Member
Join Date: Feb 2002
Location: SAC, CA
Posts: 35
|
See if this will help you...
Dim Cell As Range Dim blnCellHasData As Boolean For Each Cell In Range("A1:R1") If Cell.Value = 0 Then Rows("1:1").EntireRow.Hidden = True Else blnCellHasData = True End If Next If blnCellHasData = False Then Rows("1:1").EntireRow.Hidden = True Else Rows("1:1").EntireRow.Hidden = False End If |
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|