+ Reply to Thread
Results 1 to 6 of 6

Width of ActiveCell

  1. #1
    EXCEL NEWS
    Guest

    Width of ActiveCell


    hi,

    could you tell what is wrong with my sub

    Sub lw()
    ActiveCell.CurrentRegion.Width
    End Sub

    thanks



  2. #2
    Gary Keramidas
    Guest

    Re: Width of ActiveCell

    try this

    Sub lw()
    Dim p As Double
    p = ActiveCell.Columns.ColumnWidth
    MsgBox p
    End Sub


    --


    Gary


    "EXCEL NEWS" <[email protected]> wrote in message
    news:[email protected]...
    >
    > hi,
    >
    > could you tell what is wrong with my sub
    >
    > Sub lw()
    > ActiveCell.CurrentRegion.Width
    > End Sub
    >
    > thanks
    >
    >




  3. #3
    Ardus Petus
    Guest

    Re: Width of ActiveCell

    Your Sub does nothing.
    It references Width property (in points) of current region.

    In order to have it return a value, you must turn it into a Function

    Function lw() as Long
    lw = ActiveCell.CurrentRegion.Width
    End Function

    Now you can use your Function from within a cell or another Sub/Function.

    HTH
    --
    AP


    "EXCEL NEWS" <[email protected]> a ecrit dans le message de news:
    [email protected]...
    >
    > hi,
    >
    > could you tell what is wrong with my sub
    >
    > Sub lw()
    > ActiveCell.CurrentRegion.Width
    > End Sub
    >
    > thanks
    >
    >




  4. #4
    AA2e72E
    Guest

    RE: Width of ActiveCell

    Lookup STRCONV in the help files.



  5. #5
    EXCEL NEWS
    Guest

    Re: Width of ActiveCell

    thanks a lot,

    the sub is ok,

    you neednot change it to fun,



    "Ardus Petus" <[email protected]> wrote in message
    news:[email protected]...
    > Your Sub does nothing.
    > It references Width property (in points) of current region.
    >
    > In order to have it return a value, you must turn it into a Function
    >
    > Function lw() as Long
    > lw = ActiveCell.CurrentRegion.Width
    > End Function
    >
    > Now you can use your Function from within a cell or another Sub/Function.
    >
    > HTH
    > --
    > AP
    >
    >
    > "EXCEL NEWS" <[email protected]> a ecrit dans le message de news:
    > [email protected]...
    > >
    > > hi,
    > >
    > > could you tell what is wrong with my sub
    > >
    > > Sub lw()
    > > ActiveCell.CurrentRegion.Width
    > > End Sub
    > >
    > > thanks
    > >
    > >

    >
    >



  6. #6
    Bob Phillips
    Guest

    Re: Width of ActiveCell


    "EXCEL NEWS" <[email protected]> wrote in message
    news:[email protected]...

    > the sub is ok,
    >
    > you neednot change it to fun,
    >


    It is not it is not runnable as it stands. What are you attempting to do?



+ 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