+ Reply to Thread
Results 1 to 4 of 4

hidden column concern

Hybrid View

Guest hidden column concern 01-22-2006, 06:45 PM
Guest Re: hidden column concern 01-22-2006, 07:40 PM
Guest Re: hidden column concern 01-23-2006, 12:30 AM
Guest Re: hidden column concern 01-22-2006, 08:30 PM
  1. #1
    Bri
    Guest

    hidden column concern

    Hello

    I have a wide table (250 columns). The first 4 columns are a frozen pane.
    When I run any of a series of macros (see a sample below), some columns are
    hidden while others are shown.

    I have 2 concerns:

    a) When I run the macro, the screen flickers for a second during execution.
    No big deal, but I'd prefer it to not do this. Is my code inefficient, or
    is there some way to prevent this?

    b) All of the macros work in any combination, but sometimes I can't see the
    non-hidden columns immediately because they are too far off to the left. I
    can fix this by moving the slider on the bottom right of the screen all the
    way left. How can I get the code to do this?

    Thank you in advance


    Sub ShowTest_A_Results()
    Dim TableEndCol As Integer
    TableEndCol = 250

    For N = 5 To TableEndCol
    Select Case N
    Case 5 To 27, 32 To 68, 75 To 123, 128, 130 To TableEndCol
    Columns(N).Hidden = True
    Case Else
    Columns(N).Hidden = False
    End Select
    Next
    End Sub




  2. #2
    Dave Peterson
    Guest

    Re: hidden column concern

    You can add:

    application.screenupdating = false
    'your code that does the work
    for N = ...
    ...
    next N
    application.screenupdating = true

    b. application.goto range("A1"),scroll:=true
    or
    range("a1").select



    Bri wrote:
    >
    > Hello
    >
    > I have a wide table (250 columns). The first 4 columns are a frozen pane.
    > When I run any of a series of macros (see a sample below), some columns are
    > hidden while others are shown.
    >
    > I have 2 concerns:
    >
    > a) When I run the macro, the screen flickers for a second during execution.
    > No big deal, but I'd prefer it to not do this. Is my code inefficient, or
    > is there some way to prevent this?
    >
    > b) All of the macros work in any combination, but sometimes I can't see the
    > non-hidden columns immediately because they are too far off to the left. I
    > can fix this by moving the slider on the bottom right of the screen all the
    > way left. How can I get the code to do this?
    >
    > Thank you in advance
    >
    > Sub ShowTest_A_Results()
    > Dim TableEndCol As Integer
    > TableEndCol = 250
    >
    > For N = 5 To TableEndCol
    > Select Case N
    > Case 5 To 27, 32 To 68, 75 To 123, 128, 130 To TableEndCol
    > Columns(N).Hidden = True
    > Case Else
    > Columns(N).Hidden = False
    > End Select
    > Next
    > End Sub


    --

    Dave Peterson

  3. #3
    Bri
    Guest

    Re: hidden column concern

    Why couldn't I have thought of that! Thanks to both.
    Bri



  4. #4
    edessary@gmail.com
    Guest

    Re: hidden column concern

    To stop the flicker use Application.ScreenUpdating in your code.

    To display the hidden columns use Sendkeys to go to the home position.

    I modified your code to show the needed changes.


    Sub ShowTest_A_Results()
    Dim TableEndCol As Integer
    Application.ScreenUpdating = False

    TableEndCol = 250


    For N = 5 To TableEndCol
    Select Case N
    Case 5 To 27, 32 To 68, 75 To 123, 128, 130 To TableEndCol
    Columns(N).Hidden = True
    Case Else
    Columns(N).Hidden = False
    End Select
    Next
    Application.SendKeys ("{Home}")
    Application.ScreenUpdating = True

    End Sub


+ 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