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
![]() |
There are isolated problems with current patches, but they are well-known and documented on this site. |
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
-
Windows 11 Insider Preview build 27868 released to Canary
by
joep517
1 hour, 58 minutes ago -
X Suspends Encrypted DMs
by
Alex5723
4 hours, 10 minutes ago -
WSJ : My Robot and Me AI generated movie
by
Alex5723
4 hours, 28 minutes ago -
Botnet hacks 9,000+ ASUS routers to add persistent SSH backdoor
by
Alex5723
5 hours, 5 minutes ago -
OpenAI model sabotages shutdown code
by
Cybertooth
5 hours, 42 minutes ago -
Backup and access old e-mails after company e-mail address is terminated
by
M W Leijendekker
1 hour ago -
Enabling Secureboot
by
ITguy
51 minutes ago -
Windows hosting exposes additional bugs
by
Susan Bradley
13 hours, 36 minutes ago -
No more rounded corners??
by
CWBillow
9 hours, 24 minutes ago -
Android 15 and IPV6
by
Win7and10
1 hour, 17 minutes ago -
KB5058405 might fail to install with recovery error 0xc0000098 in ACPI.sys
by
Susan Bradley
1 day, 1 hour ago -
T-Mobile’s T-Life App has a “Screen Recording Tool” Turned on
by
Alex5723
1 day, 4 hours ago -
Windows 11 Insider Preview Build 26100.4202 (24H2) released to Release Preview
by
joep517
23 hours, 13 minutes ago -
Windows Update orchestration platform to update all software
by
Alex5723
1 day, 11 hours ago -
May preview updates
by
Susan Bradley
23 hours, 21 minutes ago -
Microsoft releases KB5061977 Windows 11 24H2, Server 2025 emergency out of band
by
Alex5723
14 hours, 56 minutes ago -
Just got this pop-up page while browsing
by
Alex5723
1 day, 4 hours ago -
KB5058379 / KB 5061768 Failures
by
crown
1 day, 1 hour ago -
Windows 10 23H2 Good to Update to ?
by
jkitc
3 hours, 25 minutes ago -
At last – installation of 24H2
by
Botswana12
2 days, 3 hours ago -
MS-DEFCON 4: As good as it gets
by
Susan Bradley
12 minutes ago -
RyTuneX optimize Windows 10/11 tool
by
Alex5723
2 days, 15 hours ago -
Can I just update from Win11 22H2 to 23H2?
by
Dave Easley
14 hours, 8 minutes ago -
Limited account permission error related to Windows Update
by
gtd12345
3 days, 5 hours ago -
Another test post
by
gtd12345
3 days, 5 hours ago -
Connect to someone else computer
by
wadeer
2 days, 23 hours ago -
Limit on User names?
by
CWBillow
3 days, 2 hours ago -
Choose the right apps for traveling
by
Peter Deegan
2 days, 16 hours ago -
BitLocker rears its head
by
Susan Bradley
2 days ago -
Who are you? (2025 edition)
by
Will Fastie
1 day, 23 hours 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.