+ Reply to Thread
Results 1 to 2 of 2

Select Area in spreadsheet which changes

  1. #1
    Registered User
    Join Date
    04-16-2013
    Location
    Guam
    MS-Off Ver
    Excel 2010
    Posts
    3

    Select Area in spreadsheet which changes

    I have a spreadsheet (attached) which will sort columns based on different criteria. Once I sort out the columns that I do not need, I would like to then sort and hide rows under the remaining columns which do not have data in that row.

    I have this code below which will hide rows which do not have data in them but I must put in the correct area to search. (Set r = Range ("F16:AC1750")

    What I would like to have is code which will find the visible remaining columns and put this information into the r= range () to sort/hide the rows.

    Thank you




    Private Sub Hide_Rows()

    Worksheets("BOQMasterList").Activate
    Dim r As Range, c As Range
    Set r = Range("F16:AC1750")
    Application.ScreenUpdating = False
    For Each c In r.Rows
    If Len(c.Cells(1).Text) + Len(c.Cells(2).Text) = 0 Then
    c.EntireRow.Hidden = True
    Else
    c.EntireRow.Hidden = False
    End If
    Next c
    Application.ScreenUpdating = True
    End Sub

  2. #2
    Forum Guru Kaper's Avatar
    Join Date
    12-14-2013
    Location
    Warsaw, Poland
    MS-Off Ver
    most often: Office 365 in Windows environment
    Posts
    8,667

    Re: Select Area in spreadsheet which changes

    As a starting point try:
    Please Login or Register  to view this content.
    I probably not followed the part about columns (as a matter of fact did not understood it well - which columns used and where length of cells shall be tested) so based on columns F and G as your data range and cells 1,2 suggested).

    PS. Note, how readability improves after applying code tags to the code. And please do edit your post (code tags are required by our http://www.excelforum.com/forum-rule...rum-rules.html )
    Last edited by Kaper; 11-05-2014 at 06:47 AM.
    Best Regards,

    Kaper

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Select Print Area
    By stevewilde in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 05-20-2013, 10:26 AM
  2. Select relative printing area with VBA
    By kingoftheace in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 10-25-2012, 02:14 AM
  3. Select Print Area
    By PiJ in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-17-2012, 08:00 AM
  4. Select area between first row and last row in a column
    By jomili in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 05-11-2011, 10:50 AM
  5. Select area to display
    By Coolboy55 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 08-15-2007, 11:55 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1