Printing selective rows

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Guest
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.
 

Excel Facts

Move date out one month or year
Use =EDATE(A2,1) for one month later. Use EDATE(A2,12) for one year later.
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 :smile:
 
Upvote 0
[Y]ou should post this question in the "Macro Questions" section since this forum is only for testing. At least that's my understanding :smile:

I can hardly blame the OP: Cross-postings & wrong choice of category in which to post will be our biggest problem with the new board, I'm afraid, and endless space consuming remarks pointing out these 'mistakes'. Darn it, I already produced at least 3 posts regarding this issue!



Aladin
This message was edited by Aladin Akyurek on 2002-02-16 11:42
 
Upvote 0
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
 
Upvote 0

Forum statistics

Threads
1,223,276
Messages
6,171,140
Members
452,381
Latest member
Nova88

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top