Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,814
Default Ron de Bruin

I'm sorry for singling you out, but you've always given me great solutions.
This piece of code will be very crucial in my application.

On a spreadsheet, I have colored yellow every range that i consider to be
User Input. I have also re-named each of these ranges.

I want a button to create a new workbook. I want to copy the names of the
ranges that are user input. I also want to copy their values. This is so
later, I can call on this file and re-use this user input.

One of the big issues I am encountering is that some of the Named Ranges are
larger than just a single cell. I have 3 particular ranges that are 10 cells
X 10 cells.

Later, if the user wants to call on one of these files containing the user
input, I want to cycle through the names of the ranges that we saved, and
copy them back to the yellow cells of the same name. If for some reason,
this yellow cell has changed names or been deleted, I want to just skip that
and move to the next.

Thanks for any help!
Steve
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Ron de Bruin

How many cells are there in all range names together

--
Regards Ron de Bruin
http://www.rondebruin.nl



"steve" wrote in message ...
I'm sorry for singling you out, but you've always given me great solutions.
This piece of code will be very crucial in my application.

On a spreadsheet, I have colored yellow every range that i consider to be
User Input. I have also re-named each of these ranges.

I want a button to create a new workbook. I want to copy the names of the
ranges that are user input. I also want to copy their values. This is so
later, I can call on this file and re-use this user input.

One of the big issues I am encountering is that some of the Named Ranges are
larger than just a single cell. I have 3 particular ranges that are 10 cells
X 10 cells.

Later, if the user wants to call on one of these files containing the user
input, I want to cycle through the names of the ranges that we saved, and
copy them back to the yellow cells of the same name. If for some reason,
this yellow cell has changed names or been deleted, I want to just skip that
and move to the next.

Thanks for any help!
Steve



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,814
Default Ron de Bruin

there about 30 user input cells that I have named. (these are individual cells)

then there are 3 "matrices" of data. they are 10 cells X 10 cells each.
for example, I have named cells A1:J10 "EpoxyMatrix". this whole area is
yellow for userinput.

so in all, there are about 35 names that will be copied. down the road,
this may increase or decrease.

Thanks,
Steve

"Ron de Bruin" wrote:

How many cells are there in all range names together

--
Regards Ron de Bruin
http://www.rondebruin.nl



"steve" wrote in message ...
I'm sorry for singling you out, but you've always given me great solutions.
This piece of code will be very crucial in my application.

On a spreadsheet, I have colored yellow every range that i consider to be
User Input. I have also re-named each of these ranges.

I want a button to create a new workbook. I want to copy the names of the
ranges that are user input. I also want to copy their values. This is so
later, I can call on this file and re-use this user input.

One of the big issues I am encountering is that some of the Named Ranges are
larger than just a single cell. I have 3 particular ranges that are 10 cells
X 10 cells.

Later, if the user wants to call on one of these files containing the user
input, I want to cycle through the names of the ranges that we saved, and
copy them back to the yellow cells of the same name. If for some reason,
this yellow cell has changed names or been deleted, I want to just skip that
and move to the next.

Thanks for any help!
Steve




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Ron de Bruin

OK, I look at it after dinner


--
Regards Ron de Bruin
http://www.rondebruin.nl



"steve" wrote in message ...
there about 30 user input cells that I have named. (these are individual cells)

then there are 3 "matrices" of data. they are 10 cells X 10 cells each.
for example, I have named cells A1:J10 "EpoxyMatrix". this whole area is
yellow for userinput.

so in all, there are about 35 names that will be copied. down the road,
this may increase or decrease.

Thanks,
Steve

"Ron de Bruin" wrote:

How many cells are there in all range names together

--
Regards Ron de Bruin
http://www.rondebruin.nl



"steve" wrote in message ...
I'm sorry for singling you out, but you've always given me great solutions.
This piece of code will be very crucial in my application.

On a spreadsheet, I have colored yellow every range that i consider to be
User Input. I have also re-named each of these ranges.

I want a button to create a new workbook. I want to copy the names of the
ranges that are user input. I also want to copy their values. This is so
later, I can call on this file and re-use this user input.

One of the big issues I am encountering is that some of the Named Ranges are
larger than just a single cell. I have 3 particular ranges that are 10 cells
X 10 cells.

Later, if the user wants to call on one of these files containing the user
input, I want to cycle through the names of the ranges that we saved, and
copy them back to the yellow cells of the same name. If for some reason,
this yellow cell has changed names or been deleted, I want to just skip that
and move to the next.

Thanks for any help!
Steve






  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Ron de Bruin

Hi Steve

Not much time on this moment (my birthday today)

But this is my idea to save your data to a new file in the same cell locations
It not save the names but we not need that because the data is in the same cells.

The Data is on a sheet named Sheet1 in my example and I save the files in C:\ with a date/time stamp

Try it and let me know if this is a good start

Sub Copy_named_ranges()
Dim ws As Worksheet
Dim wb As Workbook
Dim Nwb As Workbook
Dim Nme As name

Set wb = ThisWorkbook
Set ws = wb.Sheets("Sheet1")
Set Nwb = Workbooks.Add(xlWBATWorksheet)
wb.Activate

For Each Nme In wb.Names
If Left(Nme, Len(ws.name) + 1) = "=" & ws.name Then
With ws.Range(Nme.name)
.Copy Destination:=Nwb.Sheets(1).Range(.Address)
End With
End If
Next

Nwb.SaveAs "C:\" & Format(Now, "dd-mmm-yy h-mm-ss") & ".xls"
Nwb.Close False
End Sub


--
Regards Ron de Bruin
http://www.rondebruin.nl



"Ron de Bruin" wrote in message ...
OK, I look at it after dinner


--
Regards Ron de Bruin
http://www.rondebruin.nl



"steve" wrote in message ...
there about 30 user input cells that I have named. (these are individual cells)

then there are 3 "matrices" of data. they are 10 cells X 10 cells each.
for example, I have named cells A1:J10 "EpoxyMatrix". this whole area is
yellow for userinput.

so in all, there are about 35 names that will be copied. down the road,
this may increase or decrease.

Thanks,
Steve

"Ron de Bruin" wrote:

How many cells are there in all range names together

--
Regards Ron de Bruin
http://www.rondebruin.nl



"steve" wrote in message ...
I'm sorry for singling you out, but you've always given me great solutions.
This piece of code will be very crucial in my application.

On a spreadsheet, I have colored yellow every range that i consider to be
User Input. I have also re-named each of these ranges.

I want a button to create a new workbook. I want to copy the names of the
ranges that are user input. I also want to copy their values. This is so
later, I can call on this file and re-use this user input.

One of the big issues I am encountering is that some of the Named Ranges are
larger than just a single cell. I have 3 particular ranges that are 10 cells
X 10 cells.

Later, if the user wants to call on one of these files containing the user
input, I want to cycle through the names of the ranges that we saved, and
copy them back to the yellow cells of the same name. If for some reason,
this yellow cell has changed names or been deleted, I want to just skip that
and move to the next.

Thanks for any help!
Steve









  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Ron de Bruin


Happy Birthday Ron


--
Casey


------------------------------------------------------------------------
Casey's Profile: http://www.excelforum.com/member.php...fo&userid=4545
View this thread: http://www.excelforum.com/showthread...hreadid=570728

  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,814
Default Ron de Bruin

Ron,

Happy Belated B-day!

Thanks for the start, but I think I did a bad job explaining exactly what I
need.

I am using a workbook to bring in data from other workbooks (we'll call it
"Book1") . Book1 will prompt the user to choose a file ("Book2"). When
Book2 is selected & opened, I want to check the Named Ranges in Book2.Sheet1.
Each time this Named Range also exists in Book1, I want to copy the value
of the Named Range from Book2 to Book1.

This seems a bit confusing. This is a program that Creates Quotes.
Sometimes, we want to Re-Quote a project. Rather than type everythign in
again, I give the user the option to "Import data" from another file. The
reason i have to do it like this is that the data is not static enough to put
into a structured database. In other words, my boss changes the way we price
things (variables are added, deleted, renamed)

By importing data like this, I can bring in all of the data that is still
relevant, and ignore anything else that doesn't match up.

Thanks!
Steve

"Ron de Bruin" wrote:

Hi Steve

Not much time on this moment (my birthday today)

But this is my idea to save your data to a new file in the same cell locations
It not save the names but we not need that because the data is in the same cells.

The Data is on a sheet named Sheet1 in my example and I save the files in C:\ with a date/time stamp

Try it and let me know if this is a good start

Sub Copy_named_ranges()
Dim ws As Worksheet
Dim wb As Workbook
Dim Nwb As Workbook
Dim Nme As name

Set wb = ThisWorkbook
Set ws = wb.Sheets("Sheet1")
Set Nwb = Workbooks.Add(xlWBATWorksheet)
wb.Activate

For Each Nme In wb.Names
If Left(Nme, Len(ws.name) + 1) = "=" & ws.name Then
With ws.Range(Nme.name)
.Copy Destination:=Nwb.Sheets(1).Range(.Address)
End With
End If
Next

Nwb.SaveAs "C:\" & Format(Now, "dd-mmm-yy h-mm-ss") & ".xls"
Nwb.Close False
End Sub


--
Regards Ron de Bruin
http://www.rondebruin.nl



"Ron de Bruin" wrote in message ...
OK, I look at it after dinner


--
Regards Ron de Bruin
http://www.rondebruin.nl



"steve" wrote in message ...
there about 30 user input cells that I have named. (these are individual cells)

then there are 3 "matrices" of data. they are 10 cells X 10 cells each.
for example, I have named cells A1:J10 "EpoxyMatrix". this whole area is
yellow for userinput.

so in all, there are about 35 names that will be copied. down the road,
this may increase or decrease.

Thanks,
Steve

"Ron de Bruin" wrote:

How many cells are there in all range names together

--
Regards Ron de Bruin
http://www.rondebruin.nl



"steve" wrote in message ...
I'm sorry for singling you out, but you've always given me great solutions.
This piece of code will be very crucial in my application.

On a spreadsheet, I have colored yellow every range that i consider to be
User Input. I have also re-named each of these ranges.

I want a button to create a new workbook. I want to copy the names of the
ranges that are user input. I also want to copy their values. This is so
later, I can call on this file and re-use this user input.

One of the big issues I am encountering is that some of the Named Ranges are
larger than just a single cell. I have 3 particular ranges that are 10 cells
X 10 cells.

Later, if the user wants to call on one of these files containing the user
input, I want to cycle through the names of the ranges that we saved, and
copy them back to the yellow cells of the same name. If for some reason,
this yellow cell has changed names or been deleted, I want to just skip that
and move to the next.

Thanks for any help!
Steve








Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Q4 Ron de Bruin Newbie Excel Programming 4 August 7th 06 09:26 AM
Ron de Bruin (ADO help) Ron de Bruin Excel Programming 3 October 21st 05 06:23 AM
ATT: Ron de Bruin (ADO help) FrigidDigit[_2_] Excel Programming 7 October 19th 05 03:14 PM
? for Ron de Bruin Chet[_2_] Excel Programming 4 September 23rd 04 03:55 PM
for Ron de Bruin Valeria[_2_] Excel Programming 1 January 22nd 04 04:42 PM


All times are GMT +1. The time now is 04:43 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"