Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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" wrote in message ... 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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 ... 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" wrote in message ... 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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Do you have any event code that could modify j?
-- HTH RP (remove nothere from the email address if mailing direct) "Otto Moehrbach" wrote in message ... 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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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" wrote in message ... Do you have any event code that could modify j? -- HTH RP (remove nothere from the email address if mailing direct) "Otto Moehrbach" wrote in message ... 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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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" wrote in message ... 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" wrote in message ... Do you have any event code that could modify j? -- HTH RP (remove nothere from the email address if mailing direct) "Otto Moehrbach" wrote in message ... 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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
That was good fortune. Otto
"Bob Phillips" wrote in message ... 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" wrote in message ... 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" wrote in message ... Do you have any event code that could modify j? -- HTH RP (remove nothere from the email address if mailing direct) "Otto Moehrbach" wrote in message ... 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 |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
change of cells address | Excel Discussion (Misc queries) | |||
How Can I Globally change Address of Hyperlinks? | Excel Discussion (Misc queries) | |||
My hyperlink address change? | New Users to Excel | |||
How do I avoid excel change absolute address to relative address | Excel Discussion (Misc queries) | |||
Hyperlink change address | Excel Discussion (Misc queries) |