Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Type mismatch error only on the first run

Hi!

I have a userform and i initialize it with the code shown below. The
userform is set to show on workbook open. I get 2 consecutive "Type
mismatch" errors when the workbook opens. I cant seem to locate the
error.
Note: this happens only in Excel 2007. The code was originally written
in Excel 2003 and has no errors running there.
Please help! Thank you!

Martin


Private Sub UserForm_Initialize()
ActiveWorkbook.Sheets("START").Select
Application.ScreenUpdating = False
Application.Run "USER.xls!visible"
ActiveWorkbook.Sheets("Deltagere").Select
Range("A2").Select
Do
If IsEmpty(ActiveCell.Value) = False Then
cboProjektleder.AddItem (ActiveCell.Offset(0, 1).Value)
ActiveCell.Offset(1, 0).Select
End If
Loop Until IsEmpty(ActiveCell) = True
ActiveWorkbook.Sheets("Deltagere").Select
Range("M1").Select
If ActiveCell.Value = 0 Then
Me.MultiPage1.Pages(4).visible = False
Me.MultiPage1.Pages(5).visible = False
Me.MultiPage1.Pages(6).visible = False
ElseIf ActiveCell.Value = 1 Then
Me.MultiPage1.Pages(4).visible = True
Me.MultiPage1.Pages(5).visible = False
Me.MultiPage1.Pages(6).visible = False
ElseIf ActiveCell.Value = 2 Then
Me.MultiPage1.Pages(4).visible = True
Me.MultiPage1.Pages(5).visible = True
Me.MultiPage1.Pages(6).visible = False
ElseIf ActiveCell.Value = 3 Then
Me.MultiPage1.Pages(4).visible = True
Me.MultiPage1.Pages(5).visible = True
Me.MultiPage1.Pages(6).visible = True
End If

With NoegleInit
ActiveWorkbook.Sheets("Bookings").Activate
Range("A3").Select
Do
If IsEmpty(ActiveCell.Value) = False Then
.AddItem (ActiveCell.Value)
ActiveCell.Offset(1, 0).Select
End If
Loop Until IsEmpty(ActiveCell) = True

End With
With NoegleInit2
ActiveWorkbook.Sheets("Bookings").Activate
Range("A3").Select
Do
If IsEmpty(ActiveCell.Value) = False Then
.AddItem (ActiveCell.Value)
ActiveCell.Offset(1, 0).Select
End If
Loop Until IsEmpty(ActiveCell) = True

End With
With NoegleInit3
ActiveWorkbook.Sheets("Bookings").Activate
Range("A3").Select
Do
If IsEmpty(ActiveCell.Value) = False Then
.AddItem (ActiveCell.Value)
ActiveCell.Offset(1, 0).Select
End If
Loop Until IsEmpty(ActiveCell) = True
End With

tid = Array("2", "4", "6", "8")
For Each mask In tid
mandagtid1.AddItem mask
tirsdagtid1.AddItem mask
onsdagtid1.AddItem mask
torsdagtid1.AddItem mask
fredagtid1.AddItem mask
mandagtid2.AddItem mask
tirsdagtid2.AddItem mask
onsdagtid2.AddItem mask
torsdagtid2.AddItem mask
fredagtid2.AddItem mask

ComboBox1.AddItem mask
ComboBox2.AddItem mask
ComboBox3.AddItem mask
ComboBox4.AddItem mask
ComboBox5.AddItem mask
ComboBox6.AddItem mask
ComboBox7.AddItem mask
ComboBox8.AddItem mask
ComboBox9.AddItem mask
ComboBox10.AddItem mask

ComboBox17.AddItem mask
ComboBox18.AddItem mask
ComboBox19.AddItem mask
ComboBox20.AddItem mask
ComboBox21.AddItem mask
ComboBox22.AddItem mask
ComboBox23.AddItem mask
ComboBox24.AddItem mask
ComboBox25.AddItem mask
ComboBox26.AddItem mask
Next
Application.Run "USER.xls!veryhidden"
Application.ScreenUpdating = True
Me.MultiPage1.Value = 0
cboProjektleder.SetFocus
ActiveWorkbook.Sheets("START").Select
End Sub
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Type mismatch error only on the first run

.... Oh yes, and the error doen't reapear if I excecute the code
manually afterwards...
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 81
Default Type mismatch error only on the first run

Can you tell us which lines are the ones causing the error?

Bob Flanagan
Macro Systems
144 Dewberry Drive
Hockessin, Delaware, U.S. 19707

Phone: 302-234-9857, cell 302-584-1771
http://www.add-ins.com
Productivity add-ins and downloadable books on VB macros for Excel

"mlcs" wrote in message
...
Hi!

I have a userform and i initialize it with the code shown below. The
userform is set to show on workbook open. I get 2 consecutive "Type
mismatch" errors when the workbook opens. I cant seem to locate the
error.
Note: this happens only in Excel 2007. The code was originally written
in Excel 2003 and has no errors running there.
Please help! Thank you!

Martin


Private Sub UserForm_Initialize()
ActiveWorkbook.Sheets("START").Select
Application.ScreenUpdating = False
Application.Run "USER.xls!visible"
ActiveWorkbook.Sheets("Deltagere").Select
Range("A2").Select
Do
If IsEmpty(ActiveCell.Value) = False Then
cboProjektleder.AddItem (ActiveCell.Offset(0, 1).Value)
ActiveCell.Offset(1, 0).Select
End If
Loop Until IsEmpty(ActiveCell) = True
ActiveWorkbook.Sheets("Deltagere").Select
Range("M1").Select
If ActiveCell.Value = 0 Then
Me.MultiPage1.Pages(4).visible = False
Me.MultiPage1.Pages(5).visible = False
Me.MultiPage1.Pages(6).visible = False
ElseIf ActiveCell.Value = 1 Then
Me.MultiPage1.Pages(4).visible = True
Me.MultiPage1.Pages(5).visible = False
Me.MultiPage1.Pages(6).visible = False
ElseIf ActiveCell.Value = 2 Then
Me.MultiPage1.Pages(4).visible = True
Me.MultiPage1.Pages(5).visible = True
Me.MultiPage1.Pages(6).visible = False
ElseIf ActiveCell.Value = 3 Then
Me.MultiPage1.Pages(4).visible = True
Me.MultiPage1.Pages(5).visible = True
Me.MultiPage1.Pages(6).visible = True
End If

With NoegleInit
ActiveWorkbook.Sheets("Bookings").Activate
Range("A3").Select
Do
If IsEmpty(ActiveCell.Value) = False Then
.AddItem (ActiveCell.Value)
ActiveCell.Offset(1, 0).Select
End If
Loop Until IsEmpty(ActiveCell) = True

End With
With NoegleInit2
ActiveWorkbook.Sheets("Bookings").Activate
Range("A3").Select
Do
If IsEmpty(ActiveCell.Value) = False Then
.AddItem (ActiveCell.Value)
ActiveCell.Offset(1, 0).Select
End If
Loop Until IsEmpty(ActiveCell) = True

End With
With NoegleInit3
ActiveWorkbook.Sheets("Bookings").Activate
Range("A3").Select
Do
If IsEmpty(ActiveCell.Value) = False Then
.AddItem (ActiveCell.Value)
ActiveCell.Offset(1, 0).Select
End If
Loop Until IsEmpty(ActiveCell) = True
End With

tid = Array("2", "4", "6", "8")
For Each mask In tid
mandagtid1.AddItem mask
tirsdagtid1.AddItem mask
onsdagtid1.AddItem mask
torsdagtid1.AddItem mask
fredagtid1.AddItem mask
mandagtid2.AddItem mask
tirsdagtid2.AddItem mask
onsdagtid2.AddItem mask
torsdagtid2.AddItem mask
fredagtid2.AddItem mask

ComboBox1.AddItem mask
ComboBox2.AddItem mask
ComboBox3.AddItem mask
ComboBox4.AddItem mask
ComboBox5.AddItem mask
ComboBox6.AddItem mask
ComboBox7.AddItem mask
ComboBox8.AddItem mask
ComboBox9.AddItem mask
ComboBox10.AddItem mask

ComboBox17.AddItem mask
ComboBox18.AddItem mask
ComboBox19.AddItem mask
ComboBox20.AddItem mask
ComboBox21.AddItem mask
ComboBox22.AddItem mask
ComboBox23.AddItem mask
ComboBox24.AddItem mask
ComboBox25.AddItem mask
ComboBox26.AddItem mask
Next
Application.Run "USER.xls!veryhidden"
Application.ScreenUpdating = True
Me.MultiPage1.Value = 0
cboProjektleder.SetFocus
ActiveWorkbook.Sheets("START").Select
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
Visual Basic Error Run Time Error, Type Mismatch Meg Partridge Excel Discussion (Misc queries) 12 September 10th 08 06:10 PM
Conditional Formatting - Run Time Error '13' Type Mismatch Error ksp Excel Programming 0 July 11th 06 07:06 AM
Why is this a Type Mismatch error? Damon Excel Programming 3 June 8th 06 01:47 PM
Help: Compile error: type mismatch: array or user defined type expected lvcha.gouqizi Excel Programming 1 October 31st 05 08:20 PM
Befuddled with For Next Loop ------ Run - Time Error '13' Type Mismatch Error rdavis7408 Excel Programming 1 August 25th 04 03:54 AM


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