PC Review


Reply
Thread Tools Rate Thread

Autoreference Code

 
 
my.wandering.mind@gmail.com
Guest
Posts: n/a
 
      29th Mar 2008
Hi All,

I have a sheet with a code. I would like to make multiple copies of
this sheet, Is there a way to make the code change references
automatically?

for example:
I have a sheet with table in the range(A1:P1) and I have vba code
which performs mathematical calculations and gives me the result in
another table in the same sheet. All tables have names and vba code
uses range names to identify position and value.

When I make a copy of this sheet, the code still refers to the range
in sheet1

Is there a way to change all references to local sheet.

I hope my explanation is clear

Can anyone help me?

Thanks
vishnu
 
Reply With Quote
 
 
 
 
michael.beckinsale
Guest
Posts: n/a
 
      29th Mar 2008
Hi Vishnu,

If you copy a sheet with a named range that named range is created in
the copied sheet with the sheet name as a prefix.

nr1 = 'Sheet1'!Range("A1:A10")
becomes
'Sheet1 (2)'nr1 = 'Sheet1 (2)'!Range("A1:A10")
and if you rename the sheet
MySheet!nr1 = MySheetnr1 = MySheet!Range("A1:A10")

Youwont see this in Excel's built in dialog box but if you use a free
add-in like NameManager by Jan Karel Patriese it will be displayed.

HTH

Regards

Michael

 
Reply With Quote
 
my.wandering.mind@gmail.com
Guest
Posts: n/a
 
      30th Mar 2008

Hi Michael,

Thanks for your reply.

My mistake, I did not give you the correct definition of what I am
stuck at.

This is a full description of what I have,

Sheet(rawdata) ( this is my source sheet, the data in this sheet does
not change it is the source from where everything is pulled out)

Sheet1

Listbox 1 (This has unique values from one of the columns(D)
from rawdata)
Listbox 2 ((This has unique values from one of the columns(C)
from rawdata)
Listbox 3 (This has unique values from one of the columns(F)
from rawdata)

User chooses a value from either of the listboxes and selects one
value at a time.
Table ! is populated with user choices and the user inputs some
attributes for values chosen from the listboxes.

Table2 is copy of table 1 with blank rows deleted and unique values
from column2 of table1 are also found out.

table3 matches values in table 2 and sheet(rawdata) and finds product
of certain cells

I would like to create copies of this sheet and use them and still
have all the functionality.
When I made a copy this sheet, the vba code still corresponds to the
original sheet.

Can I make this sheet into a template(is that possible) where in I can
create as many copies of this sheet in the same workbook, and I want
and all functions and code to perform

I hope my explanation is clear

Any suggestions?

Thanks
vishnu


On Mar 29, 4:28*pm, "michael.beckinsale"
<michael.beckins...@ntlworld.com> wrote:
> Hi Vishnu,
>
> If you copy a sheet with a named range that named range is created in
> the copied sheet with the sheet name as a prefix.
>
> nr1 = 'Sheet1'!Range("A1:A10")
> becomes
> 'Sheet1 (2)'nr1 = 'Sheet1 (2)'!Range("A1:A10")
> and if you rename the sheet
> MySheet!nr1 = MySheetnr1 = MySheet!Range("A1:A10")
>
> Youwont see this in Excel's built in dialog box but if you use a free
> add-in like NameManager by Jan Karel Patriese it will be displayed.
>
> HTH
>
> Regards
>
> Michael


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Linq to XML--Are there code examples that make Linq as easy as SQL? Or how can I convert ths simple pseudo code into real code? Reece Microsoft C# .NET 4 10th Dec 2008 03:13 AM
ATI Radeon Drivers - Code 43, Code 37 & Code 10 =?Utf-8?B?SmFrZQ==?= Windows Vista Hardware 14 29th Aug 2006 05:50 AM
ATI Display Drivers - Code 43, Code 37, Code 10 Jake Windows Vista Hardware 2 8th Jul 2006 04:00 PM
what is the difference between code inside a <script> tag and code in the code-behind file? keithb Microsoft ASP .NET 1 29th Mar 2006 02:00 AM
[New] Zipoid - ZIP Code, City Name and Area Code Lookup - Zip Code to Zip Code Distance Calculation Mel Freeware 0 22nd Jul 2005 04:13 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 01:45 AM.