ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   run-time error? (https://www.excelbanter.com/excel-programming/350173-run-time-error.html)

tandavina[_2_]

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


Dave Peterson

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

NickHK

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




tandavina[_3_]

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


NickHK

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




tandavina[_4_]

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



All times are GMT +1. The time now is 12:28 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com