HTFC Forums

H.T.F.C.

How To Fix Computers





Go Back   HTFC Forums > Software Newsgroups > Microsoft Office

Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1  
Old 02-06-2008, 09:10 PM
Rob
 
Posts: n/a
Default Cell referencing in VBA

I am having a problem getting a cell address to be referenced relative in a
macro. If I use the activecell.address command the cell is absolute. If I
use the Row/Column command with [ ] to signify relative reference the
reference is relative to the location of the formula and not the original
cell. If I select cell D5 as part of my coding I want D5 to be used not
$D$5. What should I do?

Thanks,

Rob
Reply With Quote
Sponsored Links
Fix your Windows Problems - FAST.
FREE Safe Scan Registry Check. Locate & Fix Errors in Minutes!
  #2  
Old 02-07-2008, 02:01 PM
Beth Melton
 
Posts: n/a
Default Re: Cell referencing in VBA

Are you using the Macro Recorder? If so, click the Relative References
button.

Please post all follow-up questions to the newsgroup. Requests for
assistance by email cannot be acknowledged.

~~~~~~~~~~~~~~~
Beth Melton
Microsoft Office MVP

Coauthor of Word 2007 Inside Out:
http://www.microsoft.com/MSPress/boo...x#AboutTheBook

Word FAQ: http://mvps.org/word
TechTrax eZine: http://mousetrax.com/techtrax/
MVP FAQ site: http://mvps.org/

"Rob" <Rob@discussions.microsoft.com> wrote in message
news:9B9FEAD8-5C33-4617-88F2-3DEE4025B844@microsoft.com...
>I am having a problem getting a cell address to be referenced relative in a
> macro. If I use the activecell.address command the cell is absolute. If
> I
> use the Row/Column command with [ ] to signify relative reference the
> reference is relative to the location of the formula and not the original
> cell. If I select cell D5 as part of my coding I want D5 to be used not
> $D$5. What should I do?
>
> Thanks,
>
> Rob



Reply With Quote
  #3  
Old 02-08-2008, 04:06 PM
Rob
 
Posts: n/a
Default Re: Cell referencing in VBA

Beth,

I found the answer. I have to add parameters to the ActiveCell.Address
command:

ActiveCell.Address(False, False, xlA1, False, False). This makes the cell
reference relative. Do you know how to extract the cell row letter from a
cell using ActiveCell.Address? When I use ActiveCell.Address.Column I get a
number instead of the letter.

Thanks for the help.

Rob


"Beth Melton" wrote:

> Are you using the Macro Recorder? If so, click the Relative References
> button.
>
> Please post all follow-up questions to the newsgroup. Requests for
> assistance by email cannot be acknowledged.
>
> ~~~~~~~~~~~~~~~
> Beth Melton
> Microsoft Office MVP
>
> Coauthor of Word 2007 Inside Out:
> http://www.microsoft.com/MSPress/boo...x#AboutTheBook
>
> Word FAQ: http://mvps.org/word
> TechTrax eZine: http://mousetrax.com/techtrax/
> MVP FAQ site: http://mvps.org/
>
> "Rob" <Rob@discussions.microsoft.com> wrote in message
> news:9B9FEAD8-5C33-4617-88F2-3DEE4025B844@microsoft.com...
> >I am having a problem getting a cell address to be referenced relative in a
> > macro. If I use the activecell.address command the cell is absolute. If
> > I
> > use the Row/Column command with [ ] to signify relative reference the
> > reference is relative to the location of the formula and not the original
> > cell. If I select cell D5 as part of my coding I want D5 to be used not
> > $D$5. What should I do?
> >
> > Thanks,
> >
> > Rob

>
>
>

Reply With Quote
  #4  
Old 02-08-2008, 05:35 PM
Beth Melton
 
Posts: n/a
Default Re: Cell referencing in VBA

I'm not sure if you want to convert the R1C1 referencing to A1 style
referencing or simply be able to note which row/column is being referred to
visually in your workbook, but to convert, take a look at
Application.ConvertFormula.

To view R1C1 referencing style in your workbook, in Excel Options, turn on
the "R1C1 Reference style" option.

Also note there is a dedicated newsgroup for Excel VBA. You may want to post
these types of questions there to obtain a broader Excel VBA audience. :-)

Please post all follow-up questions to the newsgroup. Requests for
assistance by email cannot be acknowledged.

~~~~~~~~~~~~~~~
Beth Melton
Microsoft Office MVP

Coauthor of Word 2007 Inside Out:
http://www.microsoft.com/MSPress/boo...x#AboutTheBook

Word FAQ: http://mvps.org/word
TechTrax eZine: http://mousetrax.com/techtrax/
MVP FAQ site: http://mvps.org/

"Rob" <Rob@discussions.microsoft.com> wrote in message
news:089237C8-A516-4798-ADE2-404DBA691BAF@microsoft.com...
> Beth,
>
> I found the answer. I have to add parameters to the ActiveCell.Address
> command:
>
> ActiveCell.Address(False, False, xlA1, False, False). This makes the cell
> reference relative. Do you know how to extract the cell row letter from a
> cell using ActiveCell.Address? When I use ActiveCell.Address.Column I get
> a
> number instead of the letter.
>
> Thanks for the help.
>
> Rob
>
>
> "Beth Melton" wrote:
>
>> Are you using the Macro Recorder? If so, click the Relative References
>> button.


>> "Rob" <Rob@discussions.microsoft.com> wrote in message
>> news:9B9FEAD8-5C33-4617-88F2-3DEE4025B844@microsoft.com...
>> >I am having a problem getting a cell address to be referenced relative
>> >in a
>> > macro. If I use the activecell.address command the cell is absolute.
>> > If
>> > I
>> > use the Row/Column command with [ ] to signify relative reference the
>> > reference is relative to the location of the formula and not the
>> > original
>> > cell. If I select cell D5 as part of my coding I want D5 to be used
>> > not
>> > $D$5. What should I do?
>> >
>> > Thanks,
>> >
>> > Rob

>>
>>
>>



Reply With Quote
Sponsored Links
Reply


Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Referencing Posts ? Dwarf Windows Vista 8 10-31-2007 01:56 AM
Merge and Cross Referencing AJ Microsoft Office 0 09-26-2007 09:47 PM
Referencing Cells in a Different Worksheet Dee Microsoft Office 1 09-07-2007 03:28 PM
link a table cell to another table cell in Word davo Microsoft Office 3 07-19-2007 01:16 PM
Essay referencing on office 2007 eponine Microsoft Office 0 03-29-2007 01:10 PM


All times are GMT. The time now is 06:51 AM.


Powered by vBulletin® Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO 3.1.0
© 2004 - 2007 Web-S-Sense Pty. Ltd. Usenet and forums posts © their respective authors.
Ad Management by RedTyger