Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Sorry for my mistake:
Column A is used for marking with "X" thus The names are in column B, exam points in C, and 1st, 2nd and 3th coices are in columns D, E, F respectively. J_J |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Near as I can tell the problem is you misspelled lngcol by using an "I"
instead of an "L" Select Case rngCell(1, IngCol).Value however, even if IngCol has a value of 0, it shouldn't raise an error: set rngCell = Range("C10") ? rngCell(1,0).Address $B$10 -- Regards, Tom Ogilvy "J_J" wrote in message ... Sorry for my mistake: Column A is used for marking with "X" thus The names are in column B, exam points in C, and 1st, 2nd and 3th coices are in columns D, E, F respectively. J_J |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi Tom,
I wish that would have been the reason. But it ain't. I typed it wrongly when I was typing the follow-up question here. On the file "lngcol" is typed with an "L" not an "I". I am stuck. I am uploding the file to my website with the name "distribute.xls" Here is the link: http://www.eserceker.com/xls/distribute.xls I' ll be more then happy if you or any expert interested here will give it a try. Sorry for the non-english language used in the file. But it is straight forward. Only one button available on Sheet1 to execute all macros... Sincerely J_J "Tom Ogilvy" wrote in message ... Near as I can tell the problem is you misspelled lngcol by using an "I" instead of an "L" Select Case rngCell(1, IngCol).Value however, even if IngCol has a value of 0, it shouldn't raise an error: set rngCell = Range("C10") ? rngCell(1,0).Address $B$10 -- Regards, Tom Ogilvy "J_J" wrote in message ... Sorry for my mistake: Column A is used for marking with "X" thus The names are in column B, exam points in C, and 1st, 2nd and 3th coices are in columns D, E, F respectively. J_J |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
J_J,
You have run out of columns. RngCell is column C, so lngCol cannot exceed 254... RngCell(1, 1) is Column 3 RngCell(1, 254) is Column 256 You might try something like this... If i < 10 Or j < 10 Or k < 20 Or l < 10 Or m < 10 Or n < 10 Then lngCol = lngCol + 1 If lngCol < 255 Then GoTo StartOver End If End If Regards, Jim Cone San Francisco, USA "J_J" wrote in message ... Hi Tom, I wish that would have been the reason. But it ain't. I typed it wrongly when I was typing the follow-up question here. On the file "lngcol" is typed with an "L" not an "I". I am stuck. I am uploding the file to my website with the name "distribute.xls" Here is the link: http://www.eserceker.com/xls/distribute.xls I' ll be more then happy if you or any expert interested here will give it a try. Sorry for the non-english language used in the file. But it is straight forward. Only one button available on Sheet1 to execute all macros... Sincerely J_J "Tom Ogilvy" wrote in message ... Near as I can tell the problem is you misspelled lngcol by using an "I" instead of an "L" Select Case rngCell(1, IngCol).Value however, even if IngCol has a value of 0, it shouldn't raise an error: set rngCell = Range("C10") ? rngCell(1,0).Address $B$10 Regards, Tom Ogilvy "J_J" wrote in message ... Sorry for my mistake: Column A is used for marking with "X" thus The names are in column B, exam points in C, and 1st, 2nd and 3th coices are in columns D, E, F respectively. J_J |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Jim,
Thank you. You were correct. Now why didn't I think of that?. Do you think if I increase the Department number from 6 to 9 as described above and increase dept. capacities around 20 for most of them (which is the real case) that doesn't introduce similar problems? Regards J_J "Jim Cone" wrote in message ... J_J, You have run out of columns. RngCell is column C, so lngCol cannot exceed 254... RngCell(1, 1) is Column 3 RngCell(1, 254) is Column 256 You might try something like this... If i < 10 Or j < 10 Or k < 20 Or l < 10 Or m < 10 Or n < 10 Then lngCol = lngCol + 1 If lngCol < 255 Then GoTo StartOver End If End If Regards, Jim Cone San Francisco, USA |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
J_J,
Yes, as you have only 125 students, but would have (9 * 20) 180 capacity. You probably ought to exit when either all the students are assigned or the column limit is reached. Also, I strongly suggest you put Option Explicit at the top of each module. In addition... The "Sub SIRALA()" belongs in either module1 or module2, not the Sheet1 module. Using Application.ScreenUpdating = False at the beginning of your code and Application.ScreenUpdating = True at the end will speed things up a little. Regards, Jim Cone San Francisco, USA "J_J" wrote in message ... Jim, Thank you. You were correct. Now why didn't I think of that?. Do you think if I increase the Department number from 6 to 9 as described above and increase dept. capacities around 20 for most of them (which is the real case) that doesn't introduce similar problems? Regards J_J "Jim Cone" wrote in message ... J_J, You have run out of columns. RngCell is column C, so lngCol cannot exceed 254... RngCell(1, 1) is Column 3 RngCell(1, 254) is Column 256 You might try something like this... If i < 10 Or j < 10 Or k < 20 Or l < 10 Or m < 10 Or n < 10 Then lngCol = lngCol + 1 If lngCol < 255 Then GoTo StartOver End If End If Regards, Jim Cone San Francisco, USA |
#7
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
J_J,
More comments... I should also have recommended "Sub Doldur()" to be in a general module. Also, check the point qualification limits, for example... Case Is Range("L17").Value '50 means the student must have a point value of 51 or more, not 50 Regards, Jim Cone "Jim Cone" wrote in message ... J_J, Yes, as you have only 125 students, but would have (9 * 20) 180 capacity. You probably ought to exit when either all the students are assigned or the column limit is reached. Also, I strongly suggest you put Option Explicit at the top of each module. In addition... The "Sub SIRALA()" belongs in either module1 or module2, not the Sheet1 module. Using Application.ScreenUpdating = False at the beginning of your code and Application.ScreenUpdating = True at the end will speed things up a little. Regards, Jim Cone San Francisco, USA |
#8
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Don't the choices stop after column F
so when lngcol achieves a value of 7, you have assigned all eligible students I believe (choices are only through column F). You criteria now continues on if any department is not filled up. so your terminating condition should be: If i < 10 Or j < 10 Or k < 10 Or l < 10 Or m < 10 Or n < 10 Then lngCol = lngCol + 1 if lngCol < 7 then _ GoTo StartOver End If Jim suggested similar, but I don't believe it was as specific. Increasing department numbers or department capacities should have no effect if you add this condition. -- Regards, Tom Ogilvy "J_J" wrote in message ... Jim, Thank you. You were correct. Now why didn't I think of that?. Do you think if I increase the Department number from 6 to 9 as described above and increase dept. capacities around 20 for most of them (which is the real case) that doesn't introduce similar problems? Regards J_J "Jim Cone" wrote in message ... J_J, You have run out of columns. RngCell is column C, so lngCol cannot exceed 254... RngCell(1, 1) is Column 3 RngCell(1, 254) is Column 256 You might try something like this... If i < 10 Or j < 10 Or k < 20 Or l < 10 Or m < 10 Or n < 10 Then lngCol = lngCol + 1 If lngCol < 255 Then GoTo StartOver End If End If Regards, Jim Cone San Francisco, USA |
#9
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Tom,
Good point there. Yes I did the modification, increased the number of depts and had no problems... Thank you again for your help. J_J "Tom Ogilvy" wrote in message ... Don't the choices stop after column F so when lngcol achieves a value of 7, you have assigned all eligible students I believe (choices are only through column F). You criteria now continues on if any department is not filled up. so your terminating condition should be: If i < 10 Or j < 10 Or k < 10 Or l < 10 Or m < 10 Or n < 10 Then lngCol = lngCol + 1 if lngCol < 7 then _ GoTo StartOver End If Jim suggested similar, but I don't believe it was as specific. Increasing department numbers or department capacities should have no effect if you add this condition. -- Regards, Tom Ogilvy "J_J" wrote in message ... Jim, Thank you. You were correct. Now why didn't I think of that?. Do you think if I increase the Department number from 6 to 9 as described above and increase dept. capacities around 20 for most of them (which is the real case) that doesn't introduce similar problems? Regards J_J "Jim Cone" wrote in message ... J_J, You have run out of columns. RngCell is column C, so lngCol cannot exceed 254... RngCell(1, 1) is Column 3 RngCell(1, 254) is Column 256 You might try something like this... If i < 10 Or j < 10 Or k < 20 Or l < 10 Or m < 10 Or n < 10 Then lngCol = lngCol + 1 If lngCol < 255 Then GoTo StartOver End If End If Regards, Jim Cone San Francisco, USA |
#10
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Tom,
Please forgive me keep asking endless follow-ups ...:) But, is it possible to add students with the same points equal to last distributed student point to the dept. lists?. Regards J_J "Tom Ogilvy" wrote in message ... Don't the choices stop after column F so when lngcol achieves a value of 7, you have assigned all eligible students I believe (choices are only through column F). You criteria now continues on if any department is not filled up. so your terminating condition should be: If i < 10 Or j < 10 Or k < 10 Or l < 10 Or m < 10 Or n < 10 Then lngCol = lngCol + 1 if lngCol < 7 then _ GoTo StartOver End If Jim suggested similar, but I don't believe it was as specific. Increasing department numbers or department capacities should have no effect if you add this condition. -- Regards, Tom Ogilvy "J_J" wrote in message ... Jim, Thank you. You were correct. Now why didn't I think of that?. Do you think if I increase the Department number from 6 to 9 as described above and increase dept. capacities around 20 for most of them (which is the real case) that doesn't introduce similar problems? Regards J_J "Jim Cone" wrote in message ... J_J, You have run out of columns. RngCell is column C, so lngCol cannot exceed 254... RngCell(1, 1) is Column 3 RngCell(1, 254) is Column 256 You might try something like this... If i < 10 Or j < 10 Or k < 20 Or l < 10 Or m < 10 Or n < 10 Then lngCol = lngCol + 1 If lngCol < 255 Then GoTo StartOver End If End If Regards, Jim Cone San Francisco, USA |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Increasing number of rows beyond 65K | Setting up and Configuration of Excel | |||
Automatically increasing a number by 1 | Excel Discussion (Misc queries) | |||
Increasing Number | Excel Discussion (Misc queries) | |||
Increasing number of columns beyond IV | Excel Worksheet Functions | |||
How do I always insert last cell from a increasing array ? | Excel Worksheet Functions |