Appealing to the collective experience of the group

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

italkid
03-26-2003, 05:37 PM
Because my english is not that good,i don't understand all (maybe a zipped workbook would clear some things up).

But i simplyfied the code you posted.
These lines of code do the same as what you tried to do whit your code.
i hope it gets you in the right direction

Private Sub CommandButton1_Click()
Dim MemberCell As Range

For Each MemberCell In Range("XTUE")

Select Case MemberCell.Value
Case "500"
Sheets("Daily").Range("B10").Value = MemberCell.Offset(0, -4).Value
Case "501"
Sheets("Daily").Range("B11").Value = MemberCell.Offset(0, -4).Value
End Select

Next MemberCell
End Sub

JugHead
03-27-2003, 12:24 PM
That did it, thank you.


Because my english is not that good,i don't understand all (maybe a zipped workbook would clear some things up).

But i simplyfied the code you posted.
These lines of code do the same as what you tried to do whit your code.
i hope it gets you in the right direction

Private Sub CommandButton1_Click()
Dim MemberCell As Range

For Each MemberCell In Range("XTUE")

Select Case MemberCell.Value
Case "500"
Sheets("Daily").Range("B10").Value = MemberCell.Offset(0, -4).Value
Case "501"
Sheets("Daily").Range("B11").Value = MemberCell.Offset(0, -4).Value
End Select

Next MemberCell
End Sub

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum