poptart1108
New Member
- Joined
- Jun 12, 2017
- Messages
- 14
Hi all,
I created a workbook with 7 sheets (a master and one for each person on my team). The sheet is meant to track our commissions. I used a VLook Up Formual to match the product with the commission rate (the table is on sheet 2). Everything works on the master sheet.
However, I also put in a VBA code to copy an entire row of the master sheet to one of the remaining 6 depending on which team member sold the piece. When it copies the row, it retruns a #ref error in columns with any formula, but no errors show on the master sheet. Any ideas? See VBA code below:
<style type="text/css">p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #000000; background-color: #ffffff}p.p2 {margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #011993; background-color: #ffffff}span.s1 {color: #011993}span.s2 {color: #000000}</style>Private Sub Worksheet_Change(ByVal Target As Range)
Dim C As Range
If Intersect(Target, Me.Range("A:A")) Is Nothing Then Exit Sub
For Each C In Intersect(Target, Me.Range("A:A")).Cells
If C.Text = "Adkins" Then
C.EntireRow.Copy Worksheets("Adkins").Cells(Rows.Count, "A").End(xlUp).Offset(1).EntireRow
End If
If C.Text = "Wallace" Then
C.EntireRow.Copy Worksheets("Wallace").Cells(Rows.Count, "A").End(xlUp).Offset(1).EntireRow
End If
If C.Text = "Sachs" Then
C.EntireRow.Copy Worksheets("Sachs").Cells(Rows.Count, "A").End(xlUp).Offset(1).EntireRow
End If
If C.Text = "Leary" Then
C.EntireRow.Copy Worksheets("Leary").Cells(Rows.Count, "A").End(xlUp).Offset(1).EntireRow
End If
If C.Text = "Smith" Then
C.EntireRow.Copy Worksheets("Smith").Cells(Rows.Count, "A").End(xlUp).Offset(1).EntireRow
End If
If C.Text = "Frazier" Then
C.EntireRow.Copy Worksheets("Frazier").Cells(Rows.Count, "A").End(xlUp).Offset(1).EntireRow
End If
Next
End Sub
I created a workbook with 7 sheets (a master and one for each person on my team). The sheet is meant to track our commissions. I used a VLook Up Formual to match the product with the commission rate (the table is on sheet 2). Everything works on the master sheet.
However, I also put in a VBA code to copy an entire row of the master sheet to one of the remaining 6 depending on which team member sold the piece. When it copies the row, it retruns a #ref error in columns with any formula, but no errors show on the master sheet. Any ideas? See VBA code below:
<style type="text/css">p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #000000; background-color: #ffffff}p.p2 {margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #011993; background-color: #ffffff}span.s1 {color: #011993}span.s2 {color: #000000}</style>Private Sub Worksheet_Change(ByVal Target As Range)
Dim C As Range
If Intersect(Target, Me.Range("A:A")) Is Nothing Then Exit Sub
For Each C In Intersect(Target, Me.Range("A:A")).Cells
If C.Text = "Adkins" Then
C.EntireRow.Copy Worksheets("Adkins").Cells(Rows.Count, "A").End(xlUp).Offset(1).EntireRow
End If
If C.Text = "Wallace" Then
C.EntireRow.Copy Worksheets("Wallace").Cells(Rows.Count, "A").End(xlUp).Offset(1).EntireRow
End If
If C.Text = "Sachs" Then
C.EntireRow.Copy Worksheets("Sachs").Cells(Rows.Count, "A").End(xlUp).Offset(1).EntireRow
End If
If C.Text = "Leary" Then
C.EntireRow.Copy Worksheets("Leary").Cells(Rows.Count, "A").End(xlUp).Offset(1).EntireRow
End If
If C.Text = "Smith" Then
C.EntireRow.Copy Worksheets("Smith").Cells(Rows.Count, "A").End(xlUp).Offset(1).EntireRow
End If
If C.Text = "Frazier" Then
C.EntireRow.Copy Worksheets("Frazier").Cells(Rows.Count, "A").End(xlUp).Offset(1).EntireRow
End If
Next
End Sub