+ Reply to Thread
Results 1 to 5 of 5

Hiding 3 columns using R1C1 format

  1. #1
    Forum Contributor
    Join Date
    07-25-2008
    Location
    texas
    Posts
    178

    Hiding 3 columns using R1C1 format

    I need to specify 3 columns to hide specified as col i thru i + 2.

    Please Login or Register  to view this content.
    this doesnt work - gives me a error on the selection line (unable to set the hidden property of the range class).

    Hate to bother you guys with this simple of a problem!

  2. #2
    Registered User
    Join Date
    02-22-2010
    Location
    Montreal, Canada
    MS-Off Ver
    Excel 2003
    Posts
    36

    Re: Hiding 3 columns using R1C1 format

    I personally found it simpler to use Range.

    Range("A:A").entirecolumn.hidden = true

    Try this. Same result I believe.

  3. #3
    Forum Contributor
    Join Date
    07-25-2008
    Location
    texas
    Posts
    178

    Re: Hiding 3 columns using R1C1 format

    Franck,
    I use the R1C1 notation because I am in the middle of a do loop where I am calculating the columns. So I know the column is a number named "colnum" variable. So how can I specify that column in a column select statement in R1C1? I can't say (1,colnum) because that will hide only row 1.
    Thanks

  4. #4
    Registered User
    Join Date
    02-22-2010
    Location
    Montreal, Canada
    MS-Off Ver
    Excel 2003
    Posts
    36

    Re: Hiding 3 columns using R1C1 format

    I'd need to see a snippet of the loop you're currently in to see what variables you're working with. There should be a way depending on that. I know I make lots of loops with variables, and I am able to target certain columns and rows depending on where I am.

    For example, I can use offset :

    Please Login or Register  to view this content.
    This is just an example of course. I use lots of Offsets and Range combo in my own scripts. There might be better or more efficient ways, but this has worked for me.

  5. #5
    Forum Contributor
    Join Date
    07-25-2008
    Location
    texas
    Posts
    178

    Re: Hiding 3 columns using R1C1 format

    I got it. you just use the r1c1 and specify row 1 because its a column command so it ignores row anyway.

    Range(Cells(1, intSTartColNum), Cells(1, intEndColNum)).Select

+ 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