Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default run-time error?


What is wrong with this? it has run-time error:'13' Type mismatch.

Private Sub CommandButton2_Click()

stud_grp = Sheets("StudGrp_BU").Range("$B$24:$B$62")
CS_prog = Sheets("05_S2").Range("$D$8:$D$35")
CS_dip = Sheets("05_S2").Range("$E$8:$E$35")
time_slots = Sheets("StudGrp_BU").Range("$C$6:$CN$7")


If stud_grp = CS_prog And CS_dip Then (this was highlighted when i
clicked on the button)
time_slots = 1
End If

End Sub


Please help. Thank you.


--
tandavina
------------------------------------------------------------------------
tandavina's Profile: http://www.excelforum.com/member.php...o&userid=30334
View this thread: http://www.excelforum.com/showthread...hreadid=500483

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default run-time error?

When you do this:
CS_prog = Sheets("05_S2").Range("$D$8:$D$35")
CS_Prog becomes a 28 row x 1 column array.

Likewise:
stud_grp is a 39 rows x 1 column array.
cs_dip is 28 x 1

What are you trying to do?





tandavina wrote:

What is wrong with this? it has run-time error:'13' Type mismatch.

Private Sub CommandButton2_Click()

stud_grp = Sheets("StudGrp_BU").Range("$B$24:$B$62")
CS_prog = Sheets("05_S2").Range("$D$8:$D$35")
CS_dip = Sheets("05_S2").Range("$E$8:$E$35")
time_slots = Sheets("StudGrp_BU").Range("$C$6:$CN$7")

If stud_grp = CS_prog And CS_dip Then (this was highlighted when i
clicked on the button)
time_slots = 1
End If

End Sub

Please help. Thank you.

--
tandavina
------------------------------------------------------------------------
tandavina's Profile: http://www.excelforum.com/member.php...o&userid=30334
View this thread: http://www.excelforum.com/showthread...hreadid=500483


--

Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,391
Default run-time error?

tandavina,
It would help if you DIMensioned your variables with the correct data type.
Does "stud_grp" refer to the range, or the array of values ?
What are you trying to achieve with "CS_prog And CS_dip" ?

I would guess you want to see if the values in stud_grp are in the same as
those in the combined sequence of CS_prog followed by CS_dip ??

NickHK

"tandavina" wrote
in message ...

What is wrong with this? it has run-time error:'13' Type mismatch.

Private Sub CommandButton2_Click()

stud_grp = Sheets("StudGrp_BU").Range("$B$24:$B$62")
CS_prog = Sheets("05_S2").Range("$D$8:$D$35")
CS_dip = Sheets("05_S2").Range("$E$8:$E$35")
time_slots = Sheets("StudGrp_BU").Range("$C$6:$CN$7")


If stud_grp = CS_prog And CS_dip Then (this was highlighted when i
clicked on the button)
time_slots = 1
End If

End Sub


Please help. Thank you.


--
tandavina
------------------------------------------------------------------------
tandavina's Profile:

http://www.excelforum.com/member.php...o&userid=30334
View this thread: http://www.excelforum.com/showthread...hreadid=500483



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default run-time error?


the attached is the workbook i'm working on.
i've a button to block time slots in Sheet StudGrp_BU where i compare
the day, time, prog, and diploma from Sheet 05_S2 against student
group, day and the time slots in Sheet StudGrp_BU and then set the
block times with 1 where it will then becomes red.

how do i go about doing it?
Please help, thank you.


+-------------------------------------------------------------------+
|Filename: CS.zip |
|Download: http://www.excelforum.com/attachment.php?postid=4212 |
+-------------------------------------------------------------------+

--
tandavina
------------------------------------------------------------------------
tandavina's Profile: http://www.excelforum.com/member.php...o&userid=30334
View this thread: http://www.excelforum.com/showthread...hreadid=500483

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,391
Default run-time error?

tandavina,
Most people would choose not to download executable code from an unknown
source.
Just show a couple of lines of data.

NickHK

"tandavina" wrote
in message ...

the attached is the workbook i'm working on.
i've a button to block time slots in Sheet StudGrp_BU where i compare
the day, time, prog, and diploma from Sheet 05_S2 against student
group, day and the time slots in Sheet StudGrp_BU and then set the
block times with 1 where it will then becomes red.

how do i go about doing it?
Please help, thank you.


+-------------------------------------------------------------------+
|Filename: CS.zip |
|Download: http://www.excelforum.com/attachment.php?postid=4212 |
+-------------------------------------------------------------------+

--
tandavina
------------------------------------------------------------------------
tandavina's Profile:

http://www.excelforum.com/member.php...o&userid=30334
View this thread: http://www.excelforum.com/showthread...hreadid=500483





  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default run-time error?


alright, i've a button for blocking of time slots in worksheet 2. and
i've to use 3 values from worksheet1 to match the 2 values in this
worksheet to do so, but one value of worksheet 2 are separated into 2
values in worksheet 1 and this value of worksheet 2 is not exact match
of these 2 values. eg. in worksheet 2, its ITDF04PROGRAM1EI01 and in
worksheet 1 values are P1 and EI. how do i get them to do a close match
instead of a exact match?

then there's the other value (time) which i put it as string. for
worksheet 1, the time is eg. 0800-0950 as for the time in worksheet 2,
it is sort of hourly, and separated into 2 rows for each hour, eg.
0800, 0850 / 0900, 0950 / 1000, 1050 and so on.

how do i go about doing it?
Please help. Thank you.


Private Sub CommandButton2_Click()

stud_grp = Sheets("StudGrp_BU").Range("B24:B62")
CS_prog = Sheets("05_S2").Range("D8:D35")
CS_dip = Sheets("05_S2").Range("E8:E35")
time_slots = Sheets("StudGrp_BU").Range("C6:CN7")
block = Sheets("StudGrp_BU").Range("C24:CN62")
CS_time = Sheets("05_S2").Range("C8:C35")

Do
block = 1
Exit Do
Loop While (stud_grp = CS_prog And CS_dip) And (time_slots =
CS_time)

End Sub


--
tandavina
------------------------------------------------------------------------
tandavina's Profile: http://www.excelforum.com/member.php...o&userid=30334
View this thread: http://www.excelforum.com/showthread...hreadid=500483

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
run-time error '1004': Application-defined or object-deifined error [email protected] Excel Programming 5 August 10th 05 09:39 PM
Befuddled with For Next Loop ------ Run - Time Error '13' Type Mismatch Error rdavis7408 Excel Programming 1 August 25th 04 03:54 AM
Code Error - Run Time Error 5 (Disable Cut, Copy & Paste) Tim[_36_] Excel Programming 4 April 23rd 04 02:53 AM
Run-time error '11' & Run-time error '1004' Piers Clinton-Tarestad Excel Programming 0 January 9th 04 07:45 PM


All times are GMT +1. The time now is 08:09 PM.

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"