+ Reply to Thread
Results 1 to 11 of 11

I need to select a range and skip over the hidden columns

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

    Unhappy I need to select a range and skip over the hidden columns

    I have below a code that is selecting from A11 down as far as there is data and across a certain number of columns then sets a print area.

    Currently the columns go A, B, JW, JX, JY, JZ, KA, KB as C through to JV are hidden. I have tried to offset the columns by 7 to see if it will select A-KB but it is selecting cells that are hidden and only selecting A-G. I need it to go past the hidden columns. Here is the code:

    Please Login or Register  to view this content.

    Could I also get a code to go from A10 and move over to KB and create a range from there e.g. KB-KJ and last row from there?


    Any help appreciated.

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

    Re: I need to select a range and skip over the hidden columns

    For a range you can use SpecialCells which has a visible cells property. Note: Your above code can be condensed to 1 line.

    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: I need to select a range and skip over the hidden columns

    This doesn't seem to be doing anything.

    Its not showing any selections or print area. Please note the width of the data will always vary so column KB can't be hard coded in, hence the reason to create a range from A11 to '7' columns over (the excess data will always be hidden to create only 7 columns). Forget the print area for the mean time, I can code that later.

  4. #4
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: I need to select a range and skip over the hidden columns

    Hello morangeman,

    This can also be done using this method...
    Please Login or Register  to view this content.
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

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

    Re: I need to select a range and skip over the hidden columns

    Columns JW and KB can't be hard coded as the data will vary in width over time

  6. #6
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: I need to select a range and skip over the hidden columns

    Hello morangeman,

    Will it always start in column "JW" or is that variable as well?

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

    Re: I need to select a range and skip over the hidden columns

    That will also change. JW currently holds a 'total' column calculating formulas from the hidden columns. As more columns of formulas are added, the length of columns will get greater but they will always be hidden to show the 'total' column. It will always be the 3rd column along with the next 4 being other information needed on the end. So 7 columns altogether.

  8. #8
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: I need to select a range and skip over the hidden columns

    Hello morangeman,

    So, you need a macro to automatically detect hidden columns and set the PrintArea to the visible columns from row 11 to the lastrow?

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

    Re: I need to select a range and skip over the hidden columns

    Maybe to make things easier: (You can set the print range to it by removing the select and adding like above posts)

    Please Login or Register  to view this content.

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

    Re: I need to select a range and skip over the hidden columns

    Leith, This is exactly it but only for 7 columns

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

    Re: I need to select a range and skip over the hidden columns

    Quote Originally Posted by stnkynts View Post
    Maybe to make things easier: (You can set the print range to it by removing the select and adding like above posts)

    Please Login or Register  to view this content.

    Please, it can't have any Hardcoded Columns other than Column A

+ 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. Replies: 0
    Last Post: 01-15-2014, 05:17 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. [SOLVED] Select different range after opening a hidden file.
    By JO505 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-29-2013, 12:33 PM
  4. [SOLVED] Hide columns based on cell value - Unable to set hidden range property of Range Class
    By trillium in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 05-13-2012, 11:13 PM
  5. 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