LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default user defined type not defined issue

Jacob,

Thank you for pointing my miss. I corrected this and I continue to get the
message. What puzzles me is if I delete all the code I still get the
message. Have you heard of this problem in your experience?

Please let me know.

"Jacob Skaria" wrote:

Check out the below lines.. The variables are not delcared....OR you mean
rRng instead of Rng

Set rRng = Range(Cells(iFirstRow, vCols(x, 0)), Cells(iLastRow, vCols(x, 0)))
rRng.Name = vCols(x, 1)

If this post helps click Yes
---------------
Jacob Skaria


"DennisB" wrote:

I wrote some basic code to define ranges and then name the ranges. The code
works great when the button is clicked. However, when I type anything in a
cell I get a message "User defined type not defined". I have checked my
references which I'll note below and then show you my procedure.

I commented out the code and I still received the message, so I'm confused
why it keeps poping up.

Any ideas that will help me?

**********references*************
Visual Basic for Applications
Microsoft Excel 12.0 Object Library
OLE Automation
Microsoft Office 12.0 Object Library
Microsoft Forms 2.0 Object Library

*********code*************
Sub AssignRange()
Dim rRng As Range
Dim vCols(4, 1) As Variant
Dim iFirstRow As Integer
Dim iLastRow As Integer
Dim x As Integer


'================================================
'Set up an array to assign as name to each range
'used in the SumProduct function on the worksheet
'The number is the column, the name refers to the
'column name in the table
'================================================
vCols(0, 0) = 5 'column E
vCols(0, 1) = "SubTeam"
vCols(1, 0) = 6 'column F
vCols(1, 1) = "CurrStatus"
vCols(2, 0) = 7 'column G
vCols(2, 1) = "PlanStatus"
vCols(3, 0) = 19 'column S
vCols(3, 1) = "NextWk"
vCols(4, 0) = 22 'column V
vCols(4, 1) = "SecondWks"

'============================================
'Get the last row of the range and assign the
'first row
'============================================
iLastRow = ActiveSheet.Cells.SpecialCells(xlCellTypeLastCell) .Row - 1
iFirstRow = 24

'================================================
'loop through each column in the array and assign
'the range, and then name the range based on the
'tables column name
'================================================
For x = 0 To UBound(vCols)
Set Rng = Range(Cells(iFirstRow, vCols(x, 0)), Cells(iLastRow,
vCols(x, 0)))
Rng.Name = vCols(x, 1)
Set rRng = Nothing
Next x
MsgBox "Updated"

End Sub

 
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
User-defined Type Issue Ryan H Excel Programming 10 October 20th 09 04:56 PM
Compile error: User-defined type not defined Ayo Excel Programming 3 April 23rd 09 07:42 PM
"User-defined type not defined" message in Excel RW1946 Excel Discussion (Misc queries) 0 August 31st 05 12:14 PM
Workspace faux user-defined type not defined Chris S[_2_] Excel Programming 3 November 11th 04 05:51 PM
User-defined data type; Error: Only User-defined types... tiger_PRM Excel Programming 1 July 18th 04 03:32 PM


All times are GMT +1. The time now is 07:13 AM.

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"