+ Reply to Thread
Results 1 to 5 of 5

Excel crash - bug macro?

Hybrid View

Guest Excel crash - bug macro? 11-25-2005, 05:45 AM
Guest Re: Excel crash - bug macro? 11-25-2005, 05:55 AM
Guest Re: Excel crash - bug macro? 11-25-2005, 06:00 AM
Guest Re: Excel crash - bug macro? 11-25-2005, 06:25 AM
Guest Re: Excel crash - bug macro? 11-25-2005, 06:55 AM
  1. #1
    al007
    Guest

    Excel crash - bug macro?

    Is there any bug in the macro below - as i'm getting an error report
    when i close my excel.

    Thxs



    Sub columnWidthSelection5()


    Dim R As Long
    Dim C As Range
    Dim Rng As Range

    On Error GoTo EndMacro
    Application.ScreenUpdating = False
    Application.Calculation = xlCalculationManual

    If Selection.Columns.Count > 1 Then
    Set Rng = Selection
    Else
    Set Rng = ActiveSheet.UsedRange.Columns
    End If
    For R = Rng.Columns.Count To 1 Step -1
    If
    Application.WorksheetFunction.CountA(Rng.Columns(R).EntireColumn) = 0
    Then
    Rng.Columns(R).EntireColumn.Columnwidth = 0.5
    End If
    Next R

    EndMacro:

    Application.ScreenUpdating = True
    Application.Calculation = xlCalculationAutomatic

    End Sub


  2. #2
    Norman Jones
    Guest

    Re: Excel crash - bug macro?

    Hi Al007,

    > If
    > Application.WorksheetFunction.CountA(Rng.Columns(R).EntireColumn) = 0
    > Then


    Should all be on one line:

    If Application.WorksheetFunction.CountA(Rng.Columns(R). _
    EntireColumn) = 0
    Then

    If this is not your problem, then post the relevant error message and
    indicate the code line that is highlighted on error.


    ---
    Regards,
    Norman



    "al007" <transferxxx@gmail.com> wrote in message
    news:1132911604.303850.169160@g14g2000cwa.googlegroups.com...
    > Is there any bug in the macro below - as i'm getting an error report
    > when i close my excel.
    >
    > Thxs
    >
    >
    >
    > Sub columnWidthSelection5()
    >
    >
    > Dim R As Long
    > Dim C As Range
    > Dim Rng As Range
    >
    > On Error GoTo EndMacro
    > Application.ScreenUpdating = False
    > Application.Calculation = xlCalculationManual
    >
    > If Selection.Columns.Count > 1 Then
    > Set Rng = Selection
    > Else
    > Set Rng = ActiveSheet.UsedRange.Columns
    > End If
    > For R = Rng.Columns.Count To 1 Step -1
    > If
    > Application.WorksheetFunction.CountA(Rng.Columns(R).EntireColumn) = 0
    > Then
    > Rng.Columns(R).EntireColumn.Columnwidth = 0.5
    > End If
    > Next R
    >
    > EndMacro:
    >
    > Application.ScreenUpdating = True
    > Application.Calculation = xlCalculationAutomatic
    >
    > End Sub
    >




  3. #3
    Norman Jones
    Guest

    Re: Excel crash - bug macro?

    Hi Al007,

    Attempting to beat line wrap, the indicated code snippet should be one
    line:

    If Application.WorksheetFunction. _
    CountA(Rng.Columns(R).EntireColumn) = 0 Then


    ---
    Regards,
    Norman



    "Norman Jones" <normanjones@whereforartthou.com> wrote in message
    news:O1oIXVa8FHA.3224@TK2MSFTNGP09.phx.gbl...
    > Hi Al007,
    >
    >> If
    >> Application.WorksheetFunction.CountA(Rng.Columns(R).EntireColumn) = 0
    >> Then

    >
    > Should all be on one line:
    >
    > If Application.WorksheetFunction.CountA(Rng.Columns(R). _
    > EntireColumn) = 0
    > Then
    >
    > If this is not your problem, then post the relevant error message and
    > indicate the code line that is highlighted on error.
    >
    >
    > ---
    > Regards,
    > Norman




  4. #4
    al007
    Guest

    Re: Excel crash - bug macro?

    Not a line wrap problem - it does not work in my personal.xls file - I
    crash after use


  5. #5
    Norman Jones
    Guest

    Re: Excel crash - bug macro?

    Hi Al007,

    >> If this is not your problem, then post the relevant error message
    >> and indicate the code line that is highlighted on error.



    ---
    Regards,
    Norman


    "al007" <transferxxx@gmail.com> wrote in message
    news:1132914128.464557.267510@g47g2000cwa.googlegroups.com...
    > Not a line wrap problem - it does not work in my personal.xls file - I
    > crash after use




+ 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