Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default workbook startup creates #NAME error for UDF

For some reason, we keep getting an occassional #NAME error in cells
that contain the user defined function 'rowheight()' created by the
code shown below when we open the workbook in which it resides. It is
important to note that the workbook is a shared workbook. However, the

problem can then be easily corrected by simply pressing F2 on any one
of the #NAME cells and then pressing <Enter. Then excel recognizes
the UDF. But why doesn't it recognize it when we open the workbook,
and what can I do to correct the problem? The code sits alone in Module
1 of the workbook. All other macros are
in Module 2. This is the only UDF in the workbook.

Thanks for your help...

Code:
Function rowheight(rng As Range)
Application.Volatile
rowheight = rng.Areas(1).Cells(1, 1).rowheight
End Function

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,290
Default workbook startup creates #NAME error for UDF

Couple of questions/comments...
Is Module1 a sheet module? If so, put the function in a standard module.
"RowHeight" is already used by Excel as a property.
Try another function name to avoid confusion.
"RowSize" would take fewer key strokes. <g
--
Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware



wrote in message
For some reason, we keep getting an occassional #NAME error in cells
that contain the user defined function 'rowheight()' created by the
code shown below when we open the workbook in which it resides. It is
important to note that the workbook is a shared workbook. However, the

problem can then be easily corrected by simply pressing F2 on any one
of the #NAME cells and then pressing <Enter. Then excel recognizes
the UDF. But why doesn't it recognize it when we open the workbook,
and what can I do to correct the problem? The code sits alone in Module
1 of the workbook. All other macros are
in Module 2. This is the only UDF in the workbook.

Thanks for your help...

Code:
Function rowheight(rng As Range)
Application.Volatile
rowheight = rng.Areas(1).Cells(1, 1).rowheight
End Function

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default workbook startup creates #NAME error for UDF

How do you differentiate a sheet module from a standard module? I used
a module in the Visual Basic Editor. I'm not very experienced in
Visual Basic..

Raul..


Jim Cone wrote:
Couple of questions/comments...
Is Module1 a sheet module? If so, put the function in a standard module.
"RowHeight" is already used by Excel as a property.
Try another function name to avoid confusion.
"RowSize" would take fewer key strokes. <g
--
Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware



wrote in message
For some reason, we keep getting an occassional #NAME error in cells
that contain the user defined function 'rowheight()' created by the
code shown below when we open the workbook in which it resides. It is
important to note that the workbook is a shared workbook. However, the

problem can then be easily corrected by simply pressing F2 on any one
of the #NAME cells and then pressing <Enter. Then excel recognizes
the UDF. But why doesn't it recognize it when we open the workbook,
and what can I do to correct the problem? The code sits alone in Module
1 of the workbook. All other macros are
in Module 2. This is the only UDF in the workbook.

Thanks for your help...

Code:
Function rowheight(rng As Range)
Application.Volatile
rowheight = rng.Areas(1).Cells(1, 1).rowheight
End Function


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,290
Default workbook startup creates #NAME error for UDF

Raul,
If you right-click a sheet tab and select view code you will see
the module associated with that sheet. A sheet module, generally,
should only have code in it dealing with "events" on that sheet.
In your case, you could look at each sheet module and see if
there is any code in them.
There are five types of modules...
1. sheet modules
2. "ThisWorkbook" module
3. Class Modules
4. User form modules.
5 standard/regular modules
(technically, items 1 to 4 are all class modules)
All of these modules are viewable in the VBE.

The Sheet and ThisWorkbook modules are the only ones
creating automatically by Excel. The user has to tell Excel
to create the other ones.

A standard module is created from the "Insert" menu in the VBE by
selecting "Module". They are usually named Module1, Module 2 etc.
You are probably all right in this regard as your module has the
default name. I of course didn't know your skill level or preferences.
You can change the name of any module to almost anything you want.

I would still change the name of the Function, no matter what.
Also, the fact that you are dealing with a shared workbook is a factor
that complicates things. I and a lot of others answering questions
here just don't deal with shared workbooks and questions relating to
them generally just lie there. <g
Shared workbooks have a reputation for being erratic.

Jim Cone
San Francisco, USA




wrote in message
How do you differentiate a sheet module from a standard module? I used
a module in the Visual Basic Editor. I'm not very experienced in
Visual Basic..
Raul..


Jim Cone wrote:
Couple of questions/comments...
Is Module1 a sheet module? If so, put the function in a standard module.
"RowHeight" is already used by Excel as a property.
Try another function name to avoid confusion.
"RowSize" would take fewer key strokes. <g
--
Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware





wrote in message
For some reason, we keep getting an occassional #NAME error in cells
that contain the user defined function 'rowheight()' created by the
code shown below when we open the workbook in which it resides. It is
important to note that the workbook is a shared workbook. However, the

problem can then be easily corrected by simply pressing F2 on any one
of the #NAME cells and then pressing <Enter. Then excel recognizes
the UDF. But why doesn't it recognize it when we open the workbook,
and what can I do to correct the problem? The code sits alone in Module
1 of the workbook. All other macros are
in Module 2. This is the only UDF in the workbook.

Thanks for your help...

Code:
Function rowheight(rng As Range)
Application.Volatile
rowheight = rng.Areas(1).Cells(1, 1).rowheight
End Function


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default workbook startup creates #NAME error for UDF

If that's how you create a 'standard' module, then I did it correctly.
I don't understand why it doesn't recognize it. I'm now trying to
change the name to "rowtall" instead of "rowheight." Let's see what
happens..

Raul..

Jim Cone wrote:
Raul,
If you right-click a sheet tab and select view code you will see
the module associated with that sheet. A sheet module, generally,
should only have code in it dealing with "events" on that sheet.
In your case, you could look at each sheet module and see if
there is any code in them.
There are five types of modules...
1. sheet modules
2. "ThisWorkbook" module
3. Class Modules
4. User form modules.
5 standard/regular modules
(technically, items 1 to 4 are all class modules)
All of these modules are viewable in the VBE.

The Sheet and ThisWorkbook modules are the only ones
creating automatically by Excel. The user has to tell Excel
to create the other ones.

A standard module is created from the "Insert" menu in the VBE by
selecting "Module". They are usually named Module1, Module 2 etc.
You are probably all right in this regard as your module has the
default name. I of course didn't know your skill level or preferences.
You can change the name of any module to almost anything you want.

I would still change the name of the Function, no matter what.
Also, the fact that you are dealing with a shared workbook is a factor
that complicates things. I and a lot of others answering questions
here just don't deal with shared workbooks and questions relating to
them generally just lie there. <g
Shared workbooks have a reputation for being erratic.

Jim Cone
San Francisco, USA




wrote in message
How do you differentiate a sheet module from a standard module? I used
a module in the Visual Basic Editor. I'm not very experienced in
Visual Basic..
Raul..


Jim Cone wrote:
Couple of questions/comments...
Is Module1 a sheet module? If so, put the function in a standard module.
"RowHeight" is already used by Excel as a property.
Try another function name to avoid confusion.
"RowSize" would take fewer key strokes. <g
--
Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware





wrote in message
For some reason, we keep getting an occassional #NAME error in cells
that contain the user defined function 'rowheight()' created by the
code shown below when we open the workbook in which it resides. It is
important to note that the workbook is a shared workbook. However, the

problem can then be easily corrected by simply pressing F2 on any one
of the #NAME cells and then pressing <Enter. Then excel recognizes
the UDF. But why doesn't it recognize it when we open the workbook,
and what can I do to correct the problem? The code sits alone in Module
1 of the workbook. All other macros are
in Module 2. This is the only UDF in the workbook.

Thanks for your help...

Code:
Function rowheight(rng As Range)
Application.Volatile
rowheight = rng.Areas(1).Cells(1, 1).rowheight
End Function




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
Spacebar creates value error Dennis1188 Excel Discussion (Misc queries) 5 March 4th 07 04:58 PM
#NAME error for user defined functions at workbook startup [email protected] Excel Programming 0 December 1st 06 04:18 PM
Combobox creates error Stephen Excel Worksheet Functions 0 January 23rd 05 10:55 AM
workbook creates desktop shortcut...HELP daredevil Excel Programming 0 November 13th 03 01:53 AM
Delete creates error during Change event Random Excel Programming 4 August 28th 03 08:37 AM


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