Hi,
I have a similar issue to the one in this thread: <VBA> Copy rows to multiple worksheets based on a condition
Only I have a different condition: I don't want it to copy the same rows from the master sheet and paste it at the first blank row.
So either it has to:
Option 1 seems the best. Because of my (very) limited skills of VBA I can't seem to understand the macro and to make the right adjustments according to my needs.
If someone is willing to help me I would be very grateful. I'd be happy to clarify if more details are needed.
Thanks!
I have a similar issue to the one in this thread: <VBA> Copy rows to multiple worksheets based on a condition
Only I have a different condition: I don't want it to copy the same rows from the master sheet and paste it at the first blank row.
So either it has to:
- Not copy over the same identical rows from the master that are already exist in the sheet
- Just copy over all cells over entire range (expect for the first row as it functions as the header) and overwrite all previous data
- Delete master sheet data so that old values don't get copied over (not preferred)
Option 1 seems the best. Because of my (very) limited skills of VBA I can't seem to understand the macro and to make the right adjustments according to my needs.
If someone is willing to help me I would be very grateful. I'd be happy to clarify if more details are needed.
Thanks!
VBA Code:
ub Knop4_Klikken()
Dim copyfromws As Worksheet
Dim copytows As Worksheet
Dim cfrng As Range
Dim ctrng As Range
Dim cflr As Long
Dim ctlr As Long
Dim i As Long
Dim currval As String
Set copyfromws = Sheets("Input")
cflr = copyfromws.Cells(Rows.Count, "B").End(xlUp).Row
' Copy Row of Data to Specific Worksheet based on value in Column E
' Existing Formulas in Columns F through H or J are automatically extended to the new row of data
For i = 2 To cflr
currval = copyfromws.Cells(i, 10).Value
Set copytows = Sheets(currval)
ctlr = copytows.Cells(Rows.Count, "B").End(xlUp).Row + 1
Set cfrng = copyfromws.Range("A" & i & ":L" & i)
Set ctrng = copytows.Range("A" & ctlr & ":L" & ctlr)
ctrng.Value = cfrng.Value
Next
End Sub