+ Reply to Thread
Results 1 to 5 of 5

Read Only Visible Columns from a range

Hybrid View

ravinder_tigh Read Only Visible Columns... 06-17-2009, 12:09 AM
salimudheen Re: Read Only Visible Columns... 06-17-2009, 12:20 AM
salimudheen Re: Read Only Visible Columns... 06-17-2009, 12:27 AM
ravinder_tigh Re: Read Only Visible Columns... 06-17-2009, 12:29 AM
salimudheen Re: Read Only Visible Columns... 06-17-2009, 01:37 AM
  1. #1
    Registered User
    Join Date
    04-22-2009
    Location
    India
    MS-Off Ver
    Excel 2003
    Posts
    47

    Read Only Visible Columns from a range

    Hi Guys

    I'm Quite New To excel vba so need a little bit help regarding one of my problem

    I do hav a sheet in which i do hav some column;s n data

    Worktype
    Metrics
    April
    May
    June

    in work type few rows are hidden which i don't need what i need is i want to populate only comman metrics in other range named metrics i had build a macro for this and that's working fine but the problem is it also reads metrics from hidden rows too

    i had tried
    a loop in which i had placed as hidden column property condition

    n had used

    if cell().entirecolumn.hidden=true
    
    and 2nd is 
    
    speical cell property
    
    Rng.SpecialCells(xlCellTypeVisible),
    Both r not working
    Plz if u could help me with a macro to do this i'd be really gr8full


    Regards,
    Ravinder S
    Attached Files Attached Files
    Last edited by ravinder_tigh; 06-17-2009 at 11:14 PM.
    Thanks & Regards
    Ravinder S
    (Ravinder_tigh)

  2. #2
    Registered User
    Join Date
    07-03-2008
    Location
    Hyderabad, India
    MS-Off Ver
    2003 and 2007
    Posts
    58

    Re: Read Only Visible Columns from a range

    Hi Ravinder,
    May be the problem is the Rng (Range) object.
    First you hide the rows what are the rows you want to hide (Set Row Height = 0)
    Then Set the Rng object.
    Then read all range in Rng Object using condition Rng.SpecialCells(xlCellTypeVisible).
    Hope it works.

    Regards,
    Salim.

  3. #3
    Registered User
    Join Date
    07-03-2008
    Location
    Hyderabad, India
    MS-Off Ver
    2003 and 2007
    Posts
    58

    Re: Read Only Visible Columns from a range

    Hi Ravinder,

    Try like this,
    Sub Test()
        Dim Rng As Excel.Range
        Dim cl As Excel.Range
        
        Set Rng = ThisWorkbook.Sheets("Sheet1").Range("$A$1:$B$4")
        
        For Each cl In Rng.SpecialCells(xlCellTypeVisible)
           Debug.Print cl.Value
        Next
    End Sub
    Regards,
    Salim.
    Last edited by Leith Ross; 06-17-2009 at 02:38 AM. Reason: Added Code Tags

  4. #4
    Registered User
    Join Date
    04-22-2009
    Location
    India
    MS-Off Ver
    Excel 2003
    Posts
    47

    Re: Read Only Visible Columns from a range

    thanks a lot Salimudheen

    could u plz help me with special cell type

    dose this "xlCellTypeVisible" reads the height of cell or hidden propert of cell

  5. #5
    Registered User
    Join Date
    07-03-2008
    Location
    Hyderabad, India
    MS-Off Ver
    2003 and 2007
    Posts
    58

    Re: Read Only Visible Columns from a range

    Hi Ravinder,

    xlCellTypeVisible checks that cells rowheight or column width either one zero.

    Its only consider that the cell is not visible.

    Regards,
    Salim

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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