JugHead
03-26-2003, 07:53 AM
Guys,
I was hoping to get a little help from someone on a workbook I've been slaving over for some time now. I'm new to writing VB code (as my username would imply). Here what I'm trying to do. I've got workbook with a couple pages. 1st page is a 2 week work schedule. Names in column 1, WorkDays take the next 14 columns, with work assignments filled for each name. All ranges defined. I've been trying to write code to select case, offset and paste Name from sheet1 to sheet2 (daily schedule) so I can generate daily schedules. Would someone a lot smarter than I am, look at this and tell me what I'm doing wrong. I've tried IF..Then, Find..etc but I can't come up with anything that will work. If got about 30 conditions (possible work assigments) that I've got to meet and offset paste to the daily schedule.
The Defined Range I'm trying to sort is "XTUE" I'm trying to select and offset paste "500" and "501"
Sub SimpleSort()
Select Case XTUE
Case 1
Range("XTUE").Select
For Each MemberCell In Selection
If cell.value = "500" Then
Selection.Offset(0, -4).Copy
Sheets("Daily").Activate
Selection.Cut Destination:=Range("B10")
End If
Next
Case 2
Range("XTUE").Select
For Each MemberCell In Selection
If call.value = "501" Then
Selection.Offset(0, -4). :confused: Copy
Sheets("Daily").Activate
Selection.Cut Destination:=Range("B11")
End If
Next
End Select
End Sub
I know it's ate up, I'm kind of a tard, can anybody get me on track with the right conditions for Case and repeatedly copying to specified sheet? Thanks a bunch
I was hoping to get a little help from someone on a workbook I've been slaving over for some time now. I'm new to writing VB code (as my username would imply). Here what I'm trying to do. I've got workbook with a couple pages. 1st page is a 2 week work schedule. Names in column 1, WorkDays take the next 14 columns, with work assignments filled for each name. All ranges defined. I've been trying to write code to select case, offset and paste Name from sheet1 to sheet2 (daily schedule) so I can generate daily schedules. Would someone a lot smarter than I am, look at this and tell me what I'm doing wrong. I've tried IF..Then, Find..etc but I can't come up with anything that will work. If got about 30 conditions (possible work assigments) that I've got to meet and offset paste to the daily schedule.
The Defined Range I'm trying to sort is "XTUE" I'm trying to select and offset paste "500" and "501"
Sub SimpleSort()
Select Case XTUE
Case 1
Range("XTUE").Select
For Each MemberCell In Selection
If cell.value = "500" Then
Selection.Offset(0, -4).Copy
Sheets("Daily").Activate
Selection.Cut Destination:=Range("B10")
End If
Next
Case 2
Range("XTUE").Select
For Each MemberCell In Selection
If call.value = "501" Then
Selection.Offset(0, -4). :confused: Copy
Sheets("Daily").Activate
Selection.Cut Destination:=Range("B11")
End If
Next
End Select
End Sub
I know it's ate up, I'm kind of a tard, can anybody get me on track with the right conditions for Case and repeatedly copying to specified sheet? Thanks a bunch