I am using MS Query to pull off some information from our SQL database to create a report and without going into too much explanation, there are items popping up that should not be there (Sales orders that were supposed to be closed months ago etc). What I have been trying to do with a macro, with no success, is hide a row if the value of D2:D1500 is “” after the MS Query has run and unhide them when closing the sheet. I am very new to macros and I was able to hide one row at a time with a macro but it stopped as soon as there was data in a “D” cell and it took a long time. I have no idea how to unhide when I’m done.
Any help you folks could offer would be appreciated.
Stats
![]() |
Patch reliability is unclear. Unless you have an immediate, pressing need to install a specific patch, don't do it. |
SIGN IN | Not a member? | REGISTER | PLUS MEMBERSHIP |
-
Hide Row Macro (2000)
Home » Forums » AskWoody support » Productivity software by function » MS Excel and spreadsheet help » Hide Row Macro (2000)
- This topic has 16 replies, 5 voices, and was last updated 22 years, 7 months ago.
AuthorTopicWSStats
AskWoody LoungerJuly 12, 2002 at 4:01 pm #373545Viewing 0 reply threadsAuthorReplies-
WSJohnBF
AskWoody Lounger -
WSStats
AskWoody LoungerJuly 12, 2002 at 4:43 pm #600803Thanks for your quick reply.
I’m sorry, I forgot to mention that the cells in Col D contain a formula that returns the value “” if some conditions aren’t met. These conditions determine if the data retrieved is supposed to be there. Since the cells are not “blank” the macro is not hiding them.
It worked perfectly on rows that had no data though.
Thanks for your help. -
WSJohnBF
AskWoody LoungerJuly 12, 2002 at 4:54 pm #600806Stats, see if this does it for you:
Sub HideNullStringCellRows()
Dim rngCell As Range
For Each rngCell In Worksheets(“Sheet1”).Columns(“D:D”).SpecialCells(xlCellTypeFormulas, 2)
If rngCell.Value = “” Then rngCell.EntireRow.Hidden = True
Next rngCell
End SubThis version however doesn’t hide cells which are blank and contain no formula at all. Let me know if you also intend to hide those.
-
WSStats
AskWoody Lounger -
WSjlkirk
AskWoody Lounger -
WSsdckapr
AskWoody Lounger -
H. Legare Coleman
AskWoody Plus -
WSjlkirk
AskWoody Lounger -
H. Legare Coleman
AskWoody PlusOctober 7, 2002 at 1:33 pm #622382Sorry, I still don’t understand. Which columns do you want to hide? Do you want to hide them if there is data in any column of rows 3-10, or just if there is data in one column or a few columns? Are you trying to hide just the columns on the row where there is data, which is not possible? Lets say we get to row 4, and there is data in columns C, E, and F, what columns do you want to hide? Then, lets say we get to row 5 and there is data in a column that has already been hidden, what do you want to do?
-
WSjlkirk
AskWoody LoungerOctober 7, 2002 at 2:40 pm #622398Not your fault-I didn’t make myself clear. In my worksheet, each columns B-AE (or AF) represent a day of a month. Column A is reserved for a description of a product I price every day. There are 48 of these. Row 1 is reserved for the date in “mm/dd” format, and Row 2 for the day of the week in “DDDD” format, referencing the respective cell’s counterpart in Row 1.
I would like to input daily prices for these products in cells B3:AE51, and hide the columns where I have input the daily prices. For example, since today is the 7th, I will have already entered data in columns B-E, corresponding to Tuesday-Friday of last week (no prices for Saturdays and Sundays). Therefore, I would like to hide columns B-E.
I hope this makes more sense.
-
H. Legare Coleman
AskWoody PlusOctober 8, 2002 at 12:38 am #622552OK, I think we are close to being able to give you what you want. Just a couple of more questions.
1- Since there are no prices for Sat and Sun, do you want them included in the columns or would you like to eliminate them? How about holidays?
2- If you still want to include weekends and holidays in the columns, do you ever want to hide those columns? For instance, when you run the macro today, it would hide columns B through E. Columns F and G would be for Sat and Sun. Should those also be hidden? Same question for holidays?
3- Is there always a price for every product? In other words, if I find the last column with a price entered in row 3, can I just hide the columns B through that column, or do I have to look at all of the rows to find the last price entered?
-
WSjlkirk
AskWoody LoungerOctober 8, 2002 at 8:54 am #622619Legare,
1. I had planned in a formula to enter “N/A” for the weekend days. I would have to do it manually for holidays;
2. Yes-I had envisioned if there was either data or text in the cells in the columns (except, of course, rows 1 and 2 where the date and day show up), the columns would be hidden;
3. There will be prices for every product, every day (except, of course, Saturdays, Sundays & holidays).
Jeff -
H. Legare Coleman
AskWoody PlusOctober 9, 2002 at 2:30 am #622881 -
WSjlkirk
AskWoody Lounger -
H. Legare Coleman
AskWoody PlusOctober 9, 2002 at 1:49 pm #622965There were a couple of problems. First, when you copied the code from the Lounge you pasted directly into Excel. That causes the formatting to get all messed up, and the code would not compile. When you copy code from the Lounge, you have to paste it into Word first, then copy it from there and paste it into Excel. The second problem is that your worksheet was not exactly as I expecte it to be. You have some columns past the end of the daily data and you are filling in the “N/A” for the weekends before you get there. Both of those would cause the original macro to not work. Try the attached copy.
-
WSjlkirk
AskWoody Lounger
-
-
-
-
Viewing 0 reply threads -

Plus Membership
Donations from Plus members keep this site going. You can identify the people who support AskWoody by the Plus badge on their avatars.
AskWoody Plus members not only get access to all of the contents of this site -- including Susan Bradley's frequently updated Patch Watch listing -- they also receive weekly AskWoody Plus Newsletters (formerly Windows Secrets Newsletter) and AskWoody Plus Alerts, emails when there are important breaking developments.
Get Plus!
Welcome to our unique respite from the madness.
It's easy to post questions about Windows 11, Windows 10, Win8.1, Win7, Surface, Office, or browse through our Forums. Post anonymously or register for greater privileges. Keep it civil, please: Decorous Lounge rules strictly enforced. Questions? Contact Customer Support.
Search Newsletters
Search Forums
View the Forum
Search for Topics
Recent Topics
-
Trump signs Take It Down Act
by
Alex5723
55 minutes ago -
Do you have a maintenance window?
by
Susan Bradley
1 hour, 21 minutes ago -
Freshly discovered bug in OpenPGP.js undermines whole point of encrypted comms
by
Nibbled To Death By Ducks
2 hours, 29 minutes ago -
Success Knows No End in the World of Online Slots (Awaiting moderation)
by
isobelhartmann1
2 hours, 38 minutes ago -
Cox Communications and Charter Communications to merge
by
not so anon
4 hours, 15 minutes ago -
Help with WD usb driver on Windows 11
by
Tex265
9 hours, 24 minutes ago -
hibernate activation
by
e_belmont
13 hours, 10 minutes ago -
Red Hat Enterprise Linux 10 with AI assistant
by
Alex5723
16 hours, 57 minutes ago -
Windows 11 Insider Preview build 26200.5603 released to DEV
by
joep517
20 hours, 2 minutes ago -
Windows 11 Insider Preview build 26120.4151 (24H2) released to BETA
by
joep517
20 hours, 4 minutes ago -
Fixing Windows 24H2 failed KB5058411 install
by
Alex5723
13 minutes ago -
Out of band for Windows 10
by
Susan Bradley
1 day ago -
Giving UniGetUi a test run.
by
RetiredGeek
1 day, 7 hours ago -
Windows 11 Insider Preview Build 26100.4188 (24H2) released to Release Preview
by
joep517
1 day, 15 hours ago -
Microsoft is now putting quantum encryption in Windows builds
by
Alex5723
1 hour, 24 minutes ago -
Auto Time Zone Adjustment
by
wadeer
1 day, 19 hours ago -
To download Win 11 Pro 23H2 ISO.
by
Eddieloh
1 day, 17 hours ago -
Manage your browsing experience with Edge
by
Mary Branscombe
22 hours, 6 minutes ago -
Fewer vulnerabilities, larger updates
by
Susan Bradley
10 hours, 32 minutes ago -
Hobbies — There’s free software for that!
by
Deanna McElveen
16 hours, 56 minutes ago -
Apps included with macOS
by
Will Fastie
14 hours, 48 minutes ago -
Xfinity home internet
by
MrJimPhelps
11 hours, 35 minutes ago -
Convert PowerPoint presentation to Impress
by
RetiredGeek
1 day, 12 hours ago -
Debian 12.11 released
by
Alex5723
2 days, 16 hours ago -
Microsoft: Troubleshoot problems updating Windows
by
Alex5723
2 days, 20 hours ago -
Woman Files for Divorce After ChatGPT “Reads” Husband’s Coffee Cup
by
Alex5723
2 days ago -
Moving fwd, Win 11 Pro,, which is best? Lenovo refurb
by
Deo
3 hours, 46 minutes ago -
DBOS Advanced Network Analysis
by
Kathy Stevens
3 days, 13 hours ago -
Microsoft Edge Launching Automatically?
by
healeyinpa
3 days, 4 hours ago -
Google Chrome to block admin-level browser launches for better security
by
Alex5723
1 day, 1 hour ago
Recent blog posts
Key Links
Want to Advertise in the free newsletter? How about a gift subscription in honor of a birthday? Send an email to sb@askwoody.com to ask how.
Mastodon profile for DefConPatch
Mastodon profile for AskWoody
Home • About • FAQ • Posts & Privacy • Forums • My Account
Register • Free Newsletter • Plus Membership • Gift Certificates • MS-DEFCON Alerts
Copyright ©2004-2025 by AskWoody Tech LLC. All Rights Reserved.