Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
Ayo Ayo is offline
external usenet poster
 
Posts: 489
Default Compile error: User-defined type not defined

I am getting this compile error when I try to run the following codes, any
ideas what I did wrong?
Thanks

Private Sub cmdUpdate_Click()
Dim rngData As Range, c As Range, rngBaseline As Range
Dim WSlastRow As Long, bllastRow As Long
Dim WSbline As Worksheet, WSinsite As Worksheet

Set WSinsite = Worksheets("InSite Data")
WSlastRow = ActiveSheet.Range("B65536").End(xlUp).Row
Set rngData = WSinsite.Range("B2:AJ" & WSlastRow)
Set WSbline = Worksheets("Baseline")
bllastRow = WSbline.Range("C65536").End(xlUp).Row
Set rngBaseline = WSbline.Range("C5:C" & bllastRow)

On Error Resume Next

With WSbline
For Each c In rngBaseline.Cells
checkForUpdates c.Value, 1, 2, 16, 17, rngData
checkForUpdates c.Value, 3, 4, 30, 31, rngData
checkForUpdates c.Value, 5, 6, 18, 19, rngData
checkForUpdates c.Value, 7, 8, 20, 21, rngData
checkForUpdates c.Value, 9, 10, 12, 13, rngData
checkForUpdates c.Value, 11, 12, 26, 27, rngData
checkForUpdates c.Value, 13, 14, 10, 11, rngData
checkForUpdates c.Value, 15, 16, 14, 15, rngData
checkForUpdates c.Value, 17, 18, 8, 9, rngData
checkForUpdates c.Value, 19, 20, 6, 7, rngData
checkForUpdates c.Value, 21, 22, 22, 23, rngData
checkForUpdates c.Value, 23, 24, 33, 34, rngData
checkForUpdates c.Value, 25, 26, 34, 35, rngData
checkForUpdates c.Value, 27, 28, 24, 25, rngData
checkForUpdates c, 29, 30, 28, 29, rngData
checkForUpdates c, 31, 32, 4, 5, rngData
Next c
End With
End Sub

Sub checkForUpdates(cl As Range, clOffset1 As interger, clOffset2 As
interger, _
VlkupcolIndex1 As interger, VlkupcolIndex2 As interger,
Vlkuprng As Range)

If cl.Offset(0, clOffset1).Value <
Application.WorksheetFunction.VLookup(c1.Value, rngData, VlkupcolIndex1,
False) Then
cl.Offset(0, clOffset1).Value =
Application.WorksheetFunction.VLookup(c1.Value, rngData, VlkupcolIndex1,
False)
cl.Offset(0, clOffset2).Value =
Application.WorksheetFunction.VLookup(c1.Value, rngData, VlkupcolIndex2,
False)
cl.Offset(0, clOffset1).Interior.Color = 255
End If
End Sub
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,452
Default Compile error: User-defined type not defined

As interger

RBS


"Ayo" wrote in message
...
I am getting this compile error when I try to run the following codes, any
ideas what I did wrong?
Thanks

Private Sub cmdUpdate_Click()
Dim rngData As Range, c As Range, rngBaseline As Range
Dim WSlastRow As Long, bllastRow As Long
Dim WSbline As Worksheet, WSinsite As Worksheet

Set WSinsite = Worksheets("InSite Data")
WSlastRow = ActiveSheet.Range("B65536").End(xlUp).Row
Set rngData = WSinsite.Range("B2:AJ" & WSlastRow)
Set WSbline = Worksheets("Baseline")
bllastRow = WSbline.Range("C65536").End(xlUp).Row
Set rngBaseline = WSbline.Range("C5:C" & bllastRow)

On Error Resume Next

With WSbline
For Each c In rngBaseline.Cells
checkForUpdates c.Value, 1, 2, 16, 17, rngData
checkForUpdates c.Value, 3, 4, 30, 31, rngData
checkForUpdates c.Value, 5, 6, 18, 19, rngData
checkForUpdates c.Value, 7, 8, 20, 21, rngData
checkForUpdates c.Value, 9, 10, 12, 13, rngData
checkForUpdates c.Value, 11, 12, 26, 27, rngData
checkForUpdates c.Value, 13, 14, 10, 11, rngData
checkForUpdates c.Value, 15, 16, 14, 15, rngData
checkForUpdates c.Value, 17, 18, 8, 9, rngData
checkForUpdates c.Value, 19, 20, 6, 7, rngData
checkForUpdates c.Value, 21, 22, 22, 23, rngData
checkForUpdates c.Value, 23, 24, 33, 34, rngData
checkForUpdates c.Value, 25, 26, 34, 35, rngData
checkForUpdates c.Value, 27, 28, 24, 25, rngData
checkForUpdates c, 29, 30, 28, 29, rngData
checkForUpdates c, 31, 32, 4, 5, rngData
Next c
End With
End Sub

Sub checkForUpdates(cl As Range, clOffset1 As interger, clOffset2 As
interger, _
VlkupcolIndex1 As interger, VlkupcolIndex2 As interger,
Vlkuprng As Range)

If cl.Offset(0, clOffset1).Value <
Application.WorksheetFunction.VLookup(c1.Value, rngData, VlkupcolIndex1,
False) Then
cl.Offset(0, clOffset1).Value =
Application.WorksheetFunction.VLookup(c1.Value, rngData, VlkupcolIndex1,
False)
cl.Offset(0, clOffset2).Value =
Application.WorksheetFunction.VLookup(c1.Value, rngData, VlkupcolIndex2,
False)
cl.Offset(0, clOffset1).Interior.Color = 255
End If
End Sub


  #3   Report Post  
Posted to microsoft.public.excel.programming
Ayo Ayo is offline
external usenet poster
 
Posts: 489
Default Compile error: User-defined type not defined

Thanks RB. This is why I like some else looking through my codes. I spent
hours looking at it and never saw that.

"RB Smissaert" wrote:

As interger

RBS


"Ayo" wrote in message
...
I am getting this compile error when I try to run the following codes, any
ideas what I did wrong?
Thanks

Private Sub cmdUpdate_Click()
Dim rngData As Range, c As Range, rngBaseline As Range
Dim WSlastRow As Long, bllastRow As Long
Dim WSbline As Worksheet, WSinsite As Worksheet

Set WSinsite = Worksheets("InSite Data")
WSlastRow = ActiveSheet.Range("B65536").End(xlUp).Row
Set rngData = WSinsite.Range("B2:AJ" & WSlastRow)
Set WSbline = Worksheets("Baseline")
bllastRow = WSbline.Range("C65536").End(xlUp).Row
Set rngBaseline = WSbline.Range("C5:C" & bllastRow)

On Error Resume Next

With WSbline
For Each c In rngBaseline.Cells
checkForUpdates c.Value, 1, 2, 16, 17, rngData
checkForUpdates c.Value, 3, 4, 30, 31, rngData
checkForUpdates c.Value, 5, 6, 18, 19, rngData
checkForUpdates c.Value, 7, 8, 20, 21, rngData
checkForUpdates c.Value, 9, 10, 12, 13, rngData
checkForUpdates c.Value, 11, 12, 26, 27, rngData
checkForUpdates c.Value, 13, 14, 10, 11, rngData
checkForUpdates c.Value, 15, 16, 14, 15, rngData
checkForUpdates c.Value, 17, 18, 8, 9, rngData
checkForUpdates c.Value, 19, 20, 6, 7, rngData
checkForUpdates c.Value, 21, 22, 22, 23, rngData
checkForUpdates c.Value, 23, 24, 33, 34, rngData
checkForUpdates c.Value, 25, 26, 34, 35, rngData
checkForUpdates c.Value, 27, 28, 24, 25, rngData
checkForUpdates c, 29, 30, 28, 29, rngData
checkForUpdates c, 31, 32, 4, 5, rngData
Next c
End With
End Sub

Sub checkForUpdates(cl As Range, clOffset1 As interger, clOffset2 As
interger, _
VlkupcolIndex1 As interger, VlkupcolIndex2 As interger,
Vlkuprng As Range)

If cl.Offset(0, clOffset1).Value <
Application.WorksheetFunction.VLookup(c1.Value, rngData, VlkupcolIndex1,
False) Then
cl.Offset(0, clOffset1).Value =
Application.WorksheetFunction.VLookup(c1.Value, rngData, VlkupcolIndex1,
False)
cl.Offset(0, clOffset2).Value =
Application.WorksheetFunction.VLookup(c1.Value, rngData, VlkupcolIndex2,
False)
cl.Offset(0, clOffset1).Interior.Color = 255
End If
End Sub



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,452
Default Compile error: User-defined type not defined

What could have alerted you to the problem is the fact that when you
typed interger it didn't capitalize and didn't appear in blue.

RBS


"Ayo" wrote in message
...
Thanks RB. This is why I like some else looking through my codes. I spent
hours looking at it and never saw that.

"RB Smissaert" wrote:

As interger

RBS


"Ayo" wrote in message
...
I am getting this compile error when I try to run the following codes,
any
ideas what I did wrong?
Thanks

Private Sub cmdUpdate_Click()
Dim rngData As Range, c As Range, rngBaseline As Range
Dim WSlastRow As Long, bllastRow As Long
Dim WSbline As Worksheet, WSinsite As Worksheet

Set WSinsite = Worksheets("InSite Data")
WSlastRow = ActiveSheet.Range("B65536").End(xlUp).Row
Set rngData = WSinsite.Range("B2:AJ" & WSlastRow)
Set WSbline = Worksheets("Baseline")
bllastRow = WSbline.Range("C65536").End(xlUp).Row
Set rngBaseline = WSbline.Range("C5:C" & bllastRow)

On Error Resume Next

With WSbline
For Each c In rngBaseline.Cells
checkForUpdates c.Value, 1, 2, 16, 17, rngData
checkForUpdates c.Value, 3, 4, 30, 31, rngData
checkForUpdates c.Value, 5, 6, 18, 19, rngData
checkForUpdates c.Value, 7, 8, 20, 21, rngData
checkForUpdates c.Value, 9, 10, 12, 13, rngData
checkForUpdates c.Value, 11, 12, 26, 27, rngData
checkForUpdates c.Value, 13, 14, 10, 11, rngData
checkForUpdates c.Value, 15, 16, 14, 15, rngData
checkForUpdates c.Value, 17, 18, 8, 9, rngData
checkForUpdates c.Value, 19, 20, 6, 7, rngData
checkForUpdates c.Value, 21, 22, 22, 23, rngData
checkForUpdates c.Value, 23, 24, 33, 34, rngData
checkForUpdates c.Value, 25, 26, 34, 35, rngData
checkForUpdates c.Value, 27, 28, 24, 25, rngData
checkForUpdates c, 29, 30, 28, 29, rngData
checkForUpdates c, 31, 32, 4, 5, rngData
Next c
End With
End Sub

Sub checkForUpdates(cl As Range, clOffset1 As interger, clOffset2 As
interger, _
VlkupcolIndex1 As interger, VlkupcolIndex2 As
interger,
Vlkuprng As Range)

If cl.Offset(0, clOffset1).Value <
Application.WorksheetFunction.VLookup(c1.Value, rngData,
VlkupcolIndex1,
False) Then
cl.Offset(0, clOffset1).Value =
Application.WorksheetFunction.VLookup(c1.Value, rngData,
VlkupcolIndex1,
False)
cl.Offset(0, clOffset2).Value =
Application.WorksheetFunction.VLookup(c1.Value, rngData,
VlkupcolIndex2,
False)
cl.Offset(0, clOffset1).Interior.Color = 255
End If
End Sub




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
Forms-Compile error: user-def type not defined Tita_Guera Excel Programming 1 December 11th 08 08:40 PM
Undefined User Defined Type at compile time Michel S. Excel Programming 5 March 20th 07 04:36 PM
User Defined Type not Defined error Chip Pearson Excel Programming 0 December 7th 06 08:09 PM
Help: Compile error: type mismatch: array or user defined type expected lvcha.gouqizi Excel Programming 1 October 31st 05 09:20 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 06:49 AM.

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

About Us

"It's about Microsoft Excel"