+ Reply to Thread
Results 1 to 3 of 3

ActiveCell

  1. #1

    ActiveCell

    Get a funny problem which was working.

    Have the following. I enter 3453 in C15.

    in VB have the following

    Dim InputRange as Range
    Set InputRange = Activecell

    This should return C15 (or the active cell address). Instead it keeps
    returning 3453.

    This was working previously - any ideas - only thing I can think of is
    the Excel is 2003-SR1

    Desperate to get this working

    Thanks


  2. #2
    Harald Staff
    Guest

    Re: ActiveCell

    Your provided code does not return anything, it sets a range, which works,
    as in:


    Sub Test()
    Dim InputRange As Range
    Set InputRange = ActiveCell
    Range("C14").Select
    MsgBox "Will return from C14 to InputRange now."
    InputRange.Select
    End Sub

    What I suspect that you do is not defining which property to use, like

    MsgBox InputRange

    That lazy coding is only acceptable if you know the object model extremely
    well and don't share co de with others. You expect the Address property in
    return, but what you get is the Value property if you leave it out:

    MsgBox InputRange.Address
    MsgBox InputRange.Value
    MsgBox InputRange.Font.Name

    HTH. Best wishes Harald

    <[email protected]> skrev i melding
    news:[email protected]...
    > Get a funny problem which was working.
    >
    > Have the following. I enter 3453 in C15.
    >
    > in VB have the following
    >
    > Dim InputRange as Range
    > Set InputRange = Activecell
    >
    > This should return C15 (or the active cell address). Instead it keeps
    > returning 3453.
    >
    > This was working previously - any ideas - only thing I can think of is
    > the Excel is 2003-SR1
    >
    > Desperate to get this working
    >
    > Thanks
    >




  3. #3
    Gary''s Student
    Guest

    RE: ActiveCell

    It is defaulting to the Value.

    InputRange.Value should give 3453
    and
    InputRange.Address should give C15
    --
    Gary's Student


    "[email protected]" wrote:

    > Get a funny problem which was working.
    >
    > Have the following. I enter 3453 in C15.
    >
    > in VB have the following
    >
    > Dim InputRange as Range
    > Set InputRange = Activecell
    >
    > This should return C15 (or the active cell address). Instead it keeps
    > returning 3453.
    >
    > This was working previously - any ideas - only thing I can think of is
    > the Excel is 2003-SR1
    >
    > Desperate to get this working
    >
    > Thanks
    >
    >


+ 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