I am trying to send data to selected area of a spreadsheet but when I press enter it fills all 33 rows

  • 13 years ago
     Sheets("Employee Timesheet Only").Activate
      
        If ComboBox10.Value = "John Archibald" Then
            Range("A2").Value = ComboBox10.Value
            Else
            End If
        If ComboBox7.Value = "Sunday" Then
            Range("B2").Value = ComboBox8.Value 'Start Time
            Range("C2").Value = ComboBox9.Value 'Finish Time
            Else
            End If
        If ComboBox7.Value = "Monday" Then
            Range("G2").Value = ComboBox8.Value 'Start Time
            Range("H2").Value = ComboBox9.Value 'Finish Time
            Else
            End If
        If ComboBox7.Value = "Tuesday" Then
            Range("L2").Value = ComboBox8.Value 'Start Time
            Range("M2").Value = ComboBox9.Value 'Finish Time
            Else
            End If
        If ComboBox7.Value = "Wednesday" Then
            Range("Q2").Value = ComboBox8.Value 'Start Time
            Range("R2").Value = ComboBox9.Value 'Finish Time
            Else
            End If
        If ComboBox7.Value = "Thursday" Then
            Range("V2").Value = ComboBox8.Value 'Start Time
            Range("W2").Value = ComboBox9.Value 'Finish Time
            Else
            End If
        If ComboBox7.Value = "Friday" Then
            Range("AA2").Value = ComboBox8.Value 'Start Time
            Range("AB2").Value = ComboBox9.Value 'Finish Time
            Else
            End If
        If ComboBox7.Value = "Saturday" Then
            Range("AF2").Value = ComboBox8.Value 'Start Time
            Range("AG2").Value = ComboBox9.Value 'Finish Time
                 
            End If
       
           
           
       
            Sheets("Employee Timesheet Only").Activate
       
        If ComboBox10.Value = "Pushpasiri Bandara" Then
            Range("A4").Value = ComboBox10.Value
            End If
        If ComboBox7.Value = "Sunday" Then
            Range("B4").Value = ComboBox8.Value 'Start Time
            Range("C4").Value = ComboBox9.Value 'Finish Time
            End If
        If ComboBox7.Value = "Monday" Then
            Range("G4").Value = ComboBox8.Value 'Start Time
            Range("H4").Value = ComboBox9.Value 'Finish Time
            End If
        If ComboBox7.Value = "Tuesday" Then
            Range("L4").Value = ComboBox8.Value 'Start Time
            Range("M4").Value = ComboBox9.Value 'Finish Time
            End If
        If ComboBox7.Value = "Wednesday" Then
            Range("Q4").Value = ComboBox8.Value 'Start Time
            Range("R4").Value = ComboBox9.Value 'Finish Time
            End If
        If ComboBox7.Value = "Thursday" Then
            Range("V4").Value = ComboBox8.Value 'Start Time
            Range("W4").Value = ComboBox9.Value 'Finish Time
            End If
        If ComboBox7.Value = "Friday" Then
            Range("AA4").Value = ComboBox8.Value 'Start Time
            Range("AB4").Value = ComboBox9.Value 'Finish Time
            End If
        If ComboBox7.Value = "Saturday" Then
            Range("AF4").Value = ComboBox8.Value 'Start Time
            Range("AG4").Value = ComboBox9.Value 'Finish Time
            End If
            
       What I want to do is allow the user to enter their data in the selcted ranges, so it fill in their row only  for example A4 to AG4 and not the whole 33 people. It would appear I am missing a start and stop to each code block any ideas would be appreciated.     
        
            
            
       


















































































Post a reply

No one has replied yet! Why not be the first?

Sign in or Join us (it's free).

Contribute

Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“Walking on water and developing software from a specification are easy if both are frozen.” - Edward V Berard