Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 40
Default It's doesn't work with EXECL 2003 (it's OK with 97) why

hi

This function doesn't work but in the immediate windows that works :

Private Function Range_Table(Table As String) As Range
On Error GoTo TableGen
Table = Application.Substitute(Table, " ", "")
Set Range_Table = Names(Table).RefersToRange
Exit Function
TableGen:
Set Range_Table = ThisWorkbook.Names(Table).RefersToRange
Resume Next
End Function

Do you have a answer,

Thanks

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,440
Default It's doesn't work with EXECL 2003 (it's OK with 97) why

You can't change anything in a worksheet directly from a function that is
called from a worksheet. Functions can only replace their call with a value.
I don't think it works (from a function) in Excel97 either.

--
Kind regards,

Niek Otten

"François" wrote in message
...
hi

This function doesn't work but in the immediate windows that works :

Private Function Range_Table(Table As String) As Range
On Error GoTo TableGen
Table = Application.Substitute(Table, " ", "")
Set Range_Table = Names(Table).RefersToRange
Exit Function
TableGen:
Set Range_Table = ThisWorkbook.Names(Table).RefersToRange
Resume Next
End Function

Do you have a answer,

Thanks



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default It's doesn't work with EXECL 2003 (it's OK with 97) why

I don't have xl2003 to test it on, so xl2003 might react differently to the
use of Resume next used this way.

Try it this way

Private Function Range_Table(Table As String) As Range
Dim rng as Range
Table = Application.Substitute(Table, " ", "")
On Error Resume Next
Set Rrng = Names(Table).RefersToRange
if rng is nothing then
Set rng = ThisWorkbook.Names(Table).RefersToRange
end if
On Error goto 0
Set Range_Table = rng
End Function

That said, I don't see the point of checking without ThisWorkbook and then
Checking with ThisWorkbook - Although you might have a reason.

--
Regards,
Tom Ogilvy



"François" wrote in message
...
hi

This function doesn't work but in the immediate windows that works :

Private Function Range_Table(Table As String) As Range
On Error GoTo TableGen
Table = Application.Substitute(Table, " ", "")
Set Range_Table = Names(Table).RefersToRange
Exit Function
TableGen:
Set Range_Table = ThisWorkbook.Names(Table).RefersToRange
Resume Next
End Function

Do you have a answer,

Thanks



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 40
Default It's doesn't work with EXECL 2003 (it's OK with 97) why

Thanks for your advice but it doesn't work either

"Tom Ogilvy" wrote:

I don't have xl2003 to test it on, so xl2003 might react differently to the
use of Resume next used this way.

Try it this way

Private Function Range_Table(Table As String) As Range
Dim rng as Range
Table = Application.Substitute(Table, " ", "")
On Error Resume Next
Set Rrng = Names(Table).RefersToRange
if rng is nothing then
Set rng = ThisWorkbook.Names(Table).RefersToRange
end if
On Error goto 0
Set Range_Table = rng
End Function

That said, I don't see the point of checking without ThisWorkbook and then
Checking with ThisWorkbook - Although you might have a reason.

--
Regards,
Tom Ogilvy



"François" wrote in message
...
hi

This function doesn't work but in the immediate windows that works :

Private Function Range_Table(Table As String) As Range
On Error GoTo TableGen
Table = Application.Substitute(Table, " ", "")
Set Range_Table = Names(Table).RefersToRange
Exit Function
TableGen:
Set Range_Table = ThisWorkbook.Names(Table).RefersToRange
Resume Next
End Function

Do you have a answer,

Thanks




  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 40
Default It's doesn't work with EXECL 2003 (it's OK with 97) why

Tx for your advice

"François" wrote:

hi

This function doesn't work but in the immediate windows that works :

Private Function Range_Table(Table As String) As Range
On Error GoTo TableGen
Table = Application.Substitute(Table, " ", "")
Set Range_Table = Names(Table).RefersToRange
Exit Function
TableGen:
Set Range_Table = ThisWorkbook.Names(Table).RefersToRange
Resume Next
End Function

Do you have a answer,

Thanks

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
Execl print to fit paper Octavio New Users to Excel 1 January 22nd 06 05:31 PM
EXECL Michael Reeve Setting up and Configuration of Excel 0 January 7th 05 01:26 AM
execl sheets are blinking always MH Excel Discussion (Misc queries) 3 December 6th 04 03:26 PM
Execl 2003 XML Question Ted[_8_] Excel Programming 2 April 4th 04 02:26 AM
Need help with two Execl VBA problems ricky[_4_] Excel Programming 6 November 26th 03 10:08 PM


All times are GMT +1. The time now is 03:47 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"