![]() |
| If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|||||||
|
|
Thread Tools | Display Modes |
|
#1
|
|||
|
|||
|
was recently "upgraded" from Win2000/MSO2003 to Win7/MSO2007
The following code written in Excel 2003 works in both Excel 2003 and 2007, but when I add code to a module in the exact same syntax in Excel 2007, the system refuses to recognize it and doesn't flag me there's an error. The code: ' Name the range Range("A1").CurrentRegion.Select ' select the range you want named ActiveWorkbook.Names.Add Name:="RangeName1", RefersToR1C1:=Selection Any ideas as to why the system is acitng this way? Anysuggestions on how to fix the problem? Art |
| Ads |
|
#2
|
|||
|
|||
|
On Monday, May 14, 2012 7:39:51 AM UTC-5, c1802362 wrote:
> was recently "upgraded" from Win2000/MSO2003 to Win7/MSO2007 > > The following code written in Excel 2003 works in both Excel 2003 and > 2007, but when I add code to a module in the exact same syntax in > Excel 2007, the system refuses to recognize it and doesn't flag me > there's an error. > > The code: > > ' Name the range > Range("A1").CurrentRegion.Select ' select the range you want > named > ActiveWorkbook.Names.Add Name:="RangeName1", RefersToR1C1:=Selection > > Any ideas as to why the system is acitng this way? Anysuggestions on > how to fix the problem? > > Art You probably wanted tt but try my simpler version Sub ttt() ActiveSheet.UsedRange.Select ActiveWorkbook.Names.Add Name:="RangeName1", _ RefersToR1C1:=Selection End Sub Sub nameit() ActiveSheet.UsedRange.Name = "asusedrange" ActiveSheet.Range("a1").CurrentRegion _ ..Name = "a1curreg" End Sub |
|
#3
|
|||
|
|||
|
works for me .... Thanks! On Monday, May 14, 2012 9:27:20 AM UTC-4, Don Guillett wrote: > On Monday, May 14, 2012 7:39:51 AM UTC-5, c1802362 wrote: > > was recently "upgraded" from Win2000/MSO2003 to Win7/MSO2007 > > > > The following code written in Excel 2003 works in both Excel 2003 and > > 2007, but when I add code to a module in the exact same syntax in > > Excel 2007, the system refuses to recognize it and doesn't flag me > > there's an error. > > > > The code: > > > > ' Name the range > > Range("A1").CurrentRegion.Select ' select the range you want > > named > > ActiveWorkbook.Names.Add Name:="RangeName1", RefersToR1C1:=Selection > > > > Any ideas as to why the system is acitng this way? Anysuggestions on > > how to fix the problem? > > > > Art > > You probably wanted tt but try my simpler version > > Sub ttt() > ActiveSheet.UsedRange.Select > ActiveWorkbook.Names.Add Name:="RangeName1", _ > RefersToR1C1:=Selection > > End Sub > Sub nameit() > ActiveSheet.UsedRange.Name = "asusedrange" > ActiveSheet.Range("a1").CurrentRegion _ > .Name = "a1curreg" > > End Sub |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Naming ranges | Amin | Setting up and Configuration of Excel | 1 | April 25th 10 05:45 PM |
| Naming Ranges | [email protected] | Excel Programming | 1 | July 11th 07 07:49 AM |
| Naming Ranges | PCLIVE | Excel Programming | 5 | October 26th 06 09:26 PM |
| Naming ranges? | pmw5 | Excel Discussion (Misc queries) | 2 | March 4th 05 06:57 PM |
| naming ranges | Alexander Bogomolny | Excel Programming | 2 | July 28th 04 02:27 AM |