Macro to hide empty row with a certain range

pincivma

Board Regular
Joined
Dec 12, 2004
Messages
199
Hello again

I'm trying to do a macro that hides the entire row but with the specification of a certain range. I tried the following code but I got an error. Please help

If Range("E15:GC15") = "" Then
Selection.entireRow.Hidden = False.

Thank You
 

Some videos you may like

Excel Facts

Remove leading & trailing spaces
Save as CSV to remove all leading and trailing spaces. It is faster than using TRIM().

rpaulson

Well-known Member
Joined
Oct 4, 2007
Messages
1,107
so you want to hide row 15 if EVERY cell from column E Thru column GC is blank?
 
Last edited:

rpaulson

Well-known Member
Joined
Oct 4, 2007
Messages
1,107
THis will hide them if blank and unhide if not blank


Code:
If (WorksheetFunction.CountIf(Range("E15:GC15"), "<>" & "")) = 0 Then Rows(15).EntireRow.Hidden = True Else Rows(15).EntireRow.Hidden = False
 

Watch MrExcel Video

Forum statistics

Threads
1,109,380
Messages
5,528,366
Members
409,817
Latest member
JiNXX9500

This Week's Hot Topics

  • Change military grades into rank
    Afternoon all Need help with formula that will change military rank (i.e. 1, 2, 3 into Amn, A1C, SrA). Running IF formula that does not work...
  • VBA COUNTIF SOLUTION
    Hi The following are the errors spread across the several columns from E to Q ie. 13 columns across several sheets with more than 500 rows per...
  • INSERT ROW WITH SPECIFIS TEXT IN A COLUMN
    Hi All! How can identify that that the row to be inserted has to be inserted before 1st row with specific text in column F. If I record the...
  • Auto-Create a monthly Sign in sheet for preschool students
    The image below is what each page looks like. Above is space for the "Child Name" "Month" "Class" School days are obviously Monday-Friday but...
  • VBA vlookup multiple results
    Hi folks, Hopefully someone out there can help. I have a list to vlookup which works (ish). the lookup only picks up the first instance of the...
  • Extract values for earliest/latest times
    I am trying to put together a formula to get the earliest start time, the latest end time from column A for each person in Column B-F without the...
Top