Go Back  Xtreme Visual Basic Talk > Legacy Visual Basic (VB 4/5/6) > VBA / Office Integration > Excel > Naming Cells with Relative Reference?


Reply
 
Thread Tools Display Modes
  #1  
Old 05-12-2003, 11:28 AM
wvanthony wvanthony is offline
Newcomer
 
Join Date: Dec 2002
Posts: 9
Default Naming Cells with Relative Reference?


I have created some cell names and would like for them to be a relative reference as opposed to Absolute. In my macro I test for a user selection and then want to jump to that cell name. I use the command Range(txt).Select to jump to that location which works just fine. Here's the problem however. Anytime I insert new data to the worksheet it screws up the reference since it is an absolute reference. How can I create a cell name with a relative as opposed to absolute reference and can I still use the Range(txt).Select to jump to that cell name? Any help you could provide would be greatly appreciated.
Reply With Quote
  #2  
Old 05-12-2003, 11:37 AM
Timbo's Avatar
Timbo Timbo is offline
Green-Eyed

Super Moderator
* Guru *
 
Join Date: May 2001
Location: Bangkok, Thailand
Posts: 10,261
Default

It can't be done as simply as that, you'll either have to create a function to edit all the range definitions as you add rows, or you'll have to use variables to specifiy the required range using the 'Range(Cells(a,b), Cells(x,y))' form...
__________________
"He's not the Messiah. He's a very naughty boy!" - Brian's mum

Can't find the answer? >> Try something new!
Become a Professional
Reply With Quote
  #3  
Old 05-12-2003, 11:48 AM
wvanthony wvanthony is offline
Newcomer
 
Join Date: Dec 2002
Posts: 9
Default Relative Cell Refs

Quote:
Originally Posted by Timbo
It can't be done as simply as that, you'll either have to create a function to edit all the range definitions as you add rows, or you'll have to use variables to specifiy the required range using the 'Range(Cells(a,b), Cells(x,y))' form...




Timbo, thanks for your reply but I'm afraid it went over my head. I'm fairly new at macros. Would it be possible to give me an example or more detailed explanation of what you're talking about. What I'm doing works but is a pain in the butt to have to go back and modify the absolute cell reference for all of the names in the spreadsheet anytime i insert some more data in the spreadsheet.
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
importing certain cells of Excel workbooks into Access smb03 Database and Reporting 2 02-23-2003 02:38 PM
Tough problem. Autofilter with merged cells? metallic General 0 01-31-2003 02:47 AM
Relative Paths Sebastian Mares General 9 09-17-2002 07:04 AM
calculating cells befuddled Word, PowerPoint, Outlook, and Other Office Products 3 07-12-2002 08:11 AM
How to make sure correct Picture files reference hengkok General 5 05-22-2001 06:32 PM

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
 
 
-->