Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 02-12-2018, 06:21 AM
LearnerExcel LearnerExcel is offline How to hide rows that have no data but has formula in cells? Windows 7 32bit How to hide rows that have no data but has formula in cells? Office 2003
Advanced Beginner
How to hide rows that have no data but has formula in cells?
 
Join Date: Nov 2016
Posts: 81
LearnerExcel will become famous soon enoughLearnerExcel will become famous soon enough
Default How to hide rows that have no data but has formula in cells?


How to hide rows that have no data but has formula in cells? I am retrieving data from C:\TEST\TempData.xls to C:\TEST\AutoFill.xlsm. I want to hide the rows which have no data but has only formula in the Cells. Empty data rows are vary time to time. Sometimes I require around 200 hundred records and sometimes it exceeds 400 records. That's why there are lot of blank rows. See the attached files for reference.
Attached Files
File Type: xlsm AutoFill.xlsm (49.1 KB, 14 views)
File Type: xls TempData.xls (43.5 KB, 10 views)
Reply With Quote
  #2  
Old 02-12-2018, 05:10 PM
NoSparks NoSparks is offline How to hide rows that have no data but has formula in cells? Windows 7 64bit How to hide rows that have no data but has formula in cells? Office 2010 64bit
Excel Hobbyist
 
Join Date: Nov 2013
Location: British Columbia, Canada
Posts: 831
NoSparks is just really niceNoSparks is just really niceNoSparks is just really niceNoSparks is just really niceNoSparks is just really nice
Default

If any cell within your data area is blank, this will hide that row.
Code:
Sub HideRowsMissingData()

    Dim cl As Range, i As Integer
        
Application.ScreenUpdating = False
With Sheets("AutoFill")
    For Each cl In .Range("B6:B500")
        If cl.Value = "" Then
            .Rows(cl.Row).Hidden = True
        Else
            For i = 1 To 4
                If cl.Offset(, i).Value = "" Then
                    .Rows(cl.Row).Hidden = True
                    Exit For
                End If
            Next i
        End If
    Next cl
End With
Application.ScreenUpdating = True
End Sub
and this will un-hide all hidden rows
Code:
Sub UnHideRows()
Sheets("AutoFill").Rows.EntireRow.Hidden = False
End Sub
Reply With Quote
  #3  
Old 02-12-2018, 08:36 PM
LearnerExcel LearnerExcel is offline How to hide rows that have no data but has formula in cells? Windows 7 32bit How to hide rows that have no data but has formula in cells? Office 2003
Advanced Beginner
How to hide rows that have no data but has formula in cells?
 
Join Date: Nov 2016
Posts: 81
LearnerExcel will become famous soon enoughLearnerExcel will become famous soon enough
Default

Getting the following error:
---------------------------
Microsoft Visual Basic for Applications
---------------------------
Subscript out of range
---------------------------
OK Help
---------------------------
Reply With Quote
  #4  
Old 02-12-2018, 09:56 PM
NoSparks NoSparks is offline How to hide rows that have no data but has formula in cells? Windows 7 64bit How to hide rows that have no data but has formula in cells? Office 2010 64bit
Excel Hobbyist
 
Join Date: Nov 2013
Location: British Columbia, Canada
Posts: 831
NoSparks is just really niceNoSparks is just really niceNoSparks is just really niceNoSparks is just really niceNoSparks is just really nice
Default

The macros work fine for me in the AutoFill.xlsm file you attached to this thread.
If they didn't I would not have posted them.
Reply With Quote
  #5  
Old 02-12-2018, 11:53 PM
LearnerExcel LearnerExcel is offline How to hide rows that have no data but has formula in cells? Windows 7 32bit How to hide rows that have no data but has formula in cells? Office 2003
Advanced Beginner
How to hide rows that have no data but has formula in cells?
 
Join Date: Nov 2016
Posts: 81
LearnerExcel will become famous soon enoughLearnerExcel will become famous soon enough
Default

Yes it works quite fine with that file. But now I am using the same code on other Excel file changing the ranges.
Code:
For Each cl In .Range("A4:A503")
Code:
For i = 1 To 13
Columns: A to M
Rows: A4-A503

It throws that error.
Reply With Quote
  #6  
Old 02-13-2018, 12:14 AM
NoSparks NoSparks is offline How to hide rows that have no data but has formula in cells? Windows 7 64bit How to hide rows that have no data but has formula in cells? Office 2010 64bit
Excel Hobbyist
 
Join Date: Nov 2013
Location: British Columbia, Canada
Posts: 831
NoSparks is just really niceNoSparks is just really niceNoSparks is just really niceNoSparks is just really niceNoSparks is just really nice
Default

Guess you attached the wrong file,
Reply With Quote
  #7  
Old 02-13-2018, 02:50 AM
LearnerExcel LearnerExcel is offline How to hide rows that have no data but has formula in cells? Windows 7 32bit How to hide rows that have no data but has formula in cells? Office 2003
Advanced Beginner
How to hide rows that have no data but has formula in cells?
 
Join Date: Nov 2016
Posts: 81
LearnerExcel will become famous soon enoughLearnerExcel will become famous soon enough
Default

What I attached earlier was the sample file for testing.

I am using the wrong sheet name here. Will check.
Reply With Quote
  #8  
Old 02-13-2018, 03:41 AM
LearnerExcel LearnerExcel is offline How to hide rows that have no data but has formula in cells? Windows 7 32bit How to hide rows that have no data but has formula in cells? Office 2003
Advanced Beginner
How to hide rows that have no data but has formula in cells?
 
Join Date: Nov 2016
Posts: 81
LearnerExcel will become famous soon enoughLearnerExcel will become famous soon enough
Default

Thanks a lot. It was my fault to write wrong sheet name in the code. It's working fine now.
Reply With Quote
  #9  
Old 02-13-2018, 06:31 AM
NoSparks NoSparks is offline How to hide rows that have no data but has formula in cells? Windows 7 64bit How to hide rows that have no data but has formula in cells? Office 2010 64bit
Excel Hobbyist
 
Join Date: Nov 2013
Location: British Columbia, Canada
Posts: 831
NoSparks is just really niceNoSparks is just really niceNoSparks is just really niceNoSparks is just really niceNoSparks is just really nice
Default

Glad you figured out your error.

You might want to check things out a little further though.
Quote:
Columns: A to M
Rows: A4-A503
cl.Offset(,13) will be column N

PS: please update your profile to reflect the version of Excel you use, thanks.
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
Split data in cells and duplicate rows ballpoint Excel Programming 6 02-07-2018 05:52 PM
eliminating blan rows between cells in a column cantaining data FUGMAN Excel Programming 6 03-01-2017 07:35 AM
Formula to hide '0' from blank referenced cells formuladummy Excel 3 05-08-2014 02:33 AM
Hide Rows YounesB3 Excel 2 10-29-2012 05:40 AM
How to hide rows that have no data but has formula in cells? Sum Formula in the range with Numeric and NonNumeric data cells Spanec Excel 2 01-12-2012 09:15 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 02:47 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft