+ Reply to Thread
Results 1 to 7 of 7

Unknown address change

  1. #1
    Otto Moehrbach
    Guest

    Unknown address change

    Excel 2002, WinXP
    I have a simple 3 line code:

    MsgBox j.Address 'A4, correct
    j.Offset(, 3).Formula = "=E" & j.Row & "/C" & j.Row
    MsgBox j.Address 'D4

    "j" is a single cell range, A4. As you can see, "j" is set to D4 after the
    formula is inserted into D4. Why? I expected "j" to stay A4.
    Thanks for your help. Otto



  2. #2
    Bernie Deitrick
    Guest

    Re: Unknown address change

    Otto,

    No matter what I do, I get A4 for both msgboxes. Have you dimensioned your
    variables properly?

    Dim j As Range
    Set j = Range("A4")
    MsgBox j.Address 'A4, correct
    j.Offset(, 3).Formula = "=E" & j.Row & "/C" & j.Row
    MsgBox j.Address 'D4

    HTH,
    Bernie
    MS Excel MVP

    "Otto Moehrbach" <[email protected]> wrote in message
    news:[email protected]...
    > Excel 2002, WinXP
    > I have a simple 3 line code:
    >
    > MsgBox j.Address 'A4, correct
    > j.Offset(, 3).Formula = "=E" & j.Row & "/C" & j.Row
    > MsgBox j.Address 'D4
    >
    > "j" is a single cell range, A4. As you can see, "j" is set to D4 after

    the
    > formula is inserted into D4. Why? I expected "j" to stay A4.
    > Thanks for your help. Otto
    >
    >




  3. #3
    Bob Phillips
    Guest

    Re: Unknown address change

    Do you have any event code that could modify j?

    --

    HTH

    RP
    (remove nothere from the email address if mailing direct)


    "Otto Moehrbach" <[email protected]> wrote in message
    news:[email protected]...
    > Excel 2002, WinXP
    > I have a simple 3 line code:
    >
    > MsgBox j.Address 'A4, correct
    > j.Offset(, 3).Formula = "=E" & j.Row & "/C" & j.Row
    > MsgBox j.Address 'D4
    >
    > "j" is a single cell range, A4. As you can see, "j" is set to D4 after

    the
    > formula is inserted into D4. Why? I expected "j" to stay A4.
    > Thanks for your help. Otto
    >
    >




  4. #4
    Otto Moehrbach
    Guest

    Re: Unknown address change

    Bob
    You nailed it. I didn't think my event macros would do anything in this
    case. After you said that, I looked again. I'm running out of hair.
    Thanks again. Otto
    "Bob Phillips" <[email protected]> wrote in message
    news:eq%[email protected]...
    > Do you have any event code that could modify j?
    >
    > --
    >
    > HTH
    >
    > RP
    > (remove nothere from the email address if mailing direct)
    >
    >
    > "Otto Moehrbach" <[email protected]> wrote in message
    > news:[email protected]...
    >> Excel 2002, WinXP
    >> I have a simple 3 line code:
    >>
    >> MsgBox j.Address 'A4, correct
    >> j.Offset(, 3).Formula = "=E" & j.Row & "/C" & j.Row
    >> MsgBox j.Address 'D4
    >>
    >> "j" is a single cell range, A4. As you can see, "j" is set to D4 after

    > the
    >> formula is inserted into D4. Why? I expected "j" to stay A4.
    >> Thanks for your help. Otto
    >>
    >>

    >
    >




  5. #5
    Otto Moehrbach
    Guest

    Re: Unknown address change

    Bernie
    Thanks for your response. Bob nailed it though. I had an event macro
    that bit me. Otto
    "Bernie Deitrick" <deitbe @ consumer dot org> wrote in message
    news:O%[email protected]...
    > Otto,
    >
    > No matter what I do, I get A4 for both msgboxes. Have you dimensioned
    > your
    > variables properly?
    >
    > Dim j As Range
    > Set j = Range("A4")
    > MsgBox j.Address 'A4, correct
    > j.Offset(, 3).Formula = "=E" & j.Row & "/C" & j.Row
    > MsgBox j.Address 'D4
    >
    > HTH,
    > Bernie
    > MS Excel MVP
    >
    > "Otto Moehrbach" <[email protected]> wrote in message
    > news:[email protected]...
    >> Excel 2002, WinXP
    >> I have a simple 3 line code:
    >>
    >> MsgBox j.Address 'A4, correct
    >> j.Offset(, 3).Formula = "=E" & j.Row & "/C" & j.Row
    >> MsgBox j.Address 'D4
    >>
    >> "j" is a single cell range, A4. As you can see, "j" is set to D4 after

    > the
    >> formula is inserted into D4. Why? I expected "j" to stay A4.
    >> Thanks for your help. Otto
    >>
    >>

    >
    >




  6. #6
    Bob Phillips
    Guest

    Re: Unknown address change

    Otto,

    It only occurred to me as I had some event code in my workbook that I tested
    it on, and when I stepped through, it stepped into the event code -
    light-bulb :-)

    Bob


    "Otto Moehrbach" <[email protected]> wrote in message
    news:[email protected]...
    > Bob
    > You nailed it. I didn't think my event macros would do anything in

    this
    > case. After you said that, I looked again. I'm running out of hair.
    > Thanks again. Otto
    > "Bob Phillips" <[email protected]> wrote in message
    > news:eq%[email protected]...
    > > Do you have any event code that could modify j?
    > >
    > > --
    > >
    > > HTH
    > >
    > > RP
    > > (remove nothere from the email address if mailing direct)
    > >
    > >
    > > "Otto Moehrbach" <[email protected]> wrote in message
    > > news:[email protected]...
    > >> Excel 2002, WinXP
    > >> I have a simple 3 line code:
    > >>
    > >> MsgBox j.Address 'A4, correct
    > >> j.Offset(, 3).Formula = "=E" & j.Row & "/C" & j.Row
    > >> MsgBox j.Address 'D4
    > >>
    > >> "j" is a single cell range, A4. As you can see, "j" is set to D4 after

    > > the
    > >> formula is inserted into D4. Why? I expected "j" to stay A4.
    > >> Thanks for your help. Otto
    > >>
    > >>

    > >
    > >

    >
    >




  7. #7
    Otto Moehrbach
    Guest

    Re: Unknown address change

    That was good fortune. Otto
    "Bob Phillips" <[email protected]> wrote in message
    news:[email protected]...
    > Otto,
    >
    > It only occurred to me as I had some event code in my workbook that I
    > tested
    > it on, and when I stepped through, it stepped into the event code -
    > light-bulb :-)
    >
    > Bob
    >
    >
    > "Otto Moehrbach" <[email protected]> wrote in message
    > news:[email protected]...
    >> Bob
    >> You nailed it. I didn't think my event macros would do anything in

    > this
    >> case. After you said that, I looked again. I'm running out of hair.
    >> Thanks again. Otto
    >> "Bob Phillips" <[email protected]> wrote in message
    >> news:eq%[email protected]...
    >> > Do you have any event code that could modify j?
    >> >
    >> > --
    >> >
    >> > HTH
    >> >
    >> > RP
    >> > (remove nothere from the email address if mailing direct)
    >> >
    >> >
    >> > "Otto Moehrbach" <[email protected]> wrote in message
    >> > news:[email protected]...
    >> >> Excel 2002, WinXP
    >> >> I have a simple 3 line code:
    >> >>
    >> >> MsgBox j.Address 'A4, correct
    >> >> j.Offset(, 3).Formula = "=E" & j.Row & "/C" & j.Row
    >> >> MsgBox j.Address 'D4
    >> >>
    >> >> "j" is a single cell range, A4. As you can see, "j" is set to D4
    >> >> after
    >> > the
    >> >> formula is inserted into D4. Why? I expected "j" to stay A4.
    >> >> Thanks for your help. Otto
    >> >>
    >> >>
    >> >
    >> >

    >>
    >>

    >
    >




+ 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