+ Reply to Thread
Results 1 to 7 of 7

Skip Hidden Columns

  1. #1
    Registered User
    Join Date
    12-11-2013
    Location
    auckland
    MS-Off Ver
    Excel 2010
    Posts
    56

    Skip Hidden Columns

    I need some code to select a range starting at a1 and going across 3 rows and down to the bottom of the sheet(the last cell with any data e.g. lastrow)

    currently the columns are a, b, d as column c is hidden.

    Is offset the right coding to go with?

    column D can't be hard coded in as the number of columns hidden will change. today only C is hidden tomorrow it could be more.

    Any help is appreciated

  2. #2
    Forum Expert
    Join Date
    07-31-2010
    Location
    California
    MS-Off Ver
    Excel 2007
    Posts
    4,070

    Re: Skip Hidden Columns

    Try this:

    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    12-11-2013
    Location
    auckland
    MS-Off Ver
    Excel 2010
    Posts
    56

    Re: Skip Hidden Columns

    Quote Originally Posted by stnkynts View Post
    Try this:

    Please Login or Register  to view this content.
    Is there a way to get this code to only select across a certain number of columns as this code seems to be selecting everything on the sheet. there is data in columns E onwards but I only want to select the first 3 visible columns

  4. #4
    Forum Expert
    Join Date
    07-31-2010
    Location
    California
    MS-Off Ver
    Excel 2007
    Posts
    4,070

    Re: Skip Hidden Columns

    Is there a way to get this code to only select across a certain number of columns as this code seems to be selecting everything on the sheet.
    Of course. I misread your original post. Sorry about that:

    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    12-11-2013
    Location
    auckland
    MS-Off Ver
    Excel 2010
    Posts
    56

    Re: Skip Hidden Columns

    Quote Originally Posted by stnkynts View Post
    Of course. I misread your original post. Sorry about that:

    Please Login or Register  to view this content.

    This code is perfect. Is there also a variation i can make to the code if i wanted to start the selection at a particular row e.g. row A10 or starting it at a different column in the sheet?

  6. #6
    Forum Expert
    Join Date
    07-31-2010
    Location
    California
    MS-Off Ver
    Excel 2007
    Posts
    4,070

    Re: Skip Hidden Columns

    Please Login or Register  to view this content.
    The above line is the range. You can alter your range by changing the parameters here. For example: ws.Cells(1,1) is A1. ws.Cells(10, 1) would be A10. Starting at a different column would also require you to change the iCol start. In other words if you wanted to start at column C it would be For iCol = 3 to ws.UsedRange.Columns.Count and ws.Cells(1, 3) respectively.

  7. #7
    Registered User
    Join Date
    12-11-2013
    Location
    auckland
    MS-Off Ver
    Excel 2010
    Posts
    56

    Re: Skip Hidden Columns

    Quote Originally Posted by stnkynts View Post
    Please Login or Register  to view this content.
    The above line is the range. You can alter your range by changing the parameters here. For example: ws.Cells(1,1) is A1. ws.Cells(10, 1) would be A10. Starting at a different column would also require you to change the iCol start. In other words if you wanted to start at column C it would be For iCol = 3 to ws.UsedRange.Columns.Count and ws.Cells(1, 3) respectively.

    Thank you very much for this!!!!!!!!!!!!!!!

+ 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. I need to select a range and skip over the hidden columns
    By morangeman in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 05-06-2014, 09:29 PM
  2. How to paste data skip columns hidden?
    By minhphuong_humg in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 09-13-2013, 02:55 AM
  3. Copy and skip hidden cells
    By imerial in forum Excel - New Users/Basics
    Replies: 5
    Last Post: 03-25-2013, 09:32 AM
  4. Replies: 0
    Last Post: 09-13-2012, 11:10 AM
  5. [SOLVED] skip hidden sheets
    By savalou in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 10-18-2005, 04:05 PM

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