I have a sheet with a range of A12:n112, and within this range column A will be "0" OR "1" based on other criteria. (I have code which sorts the data so that all the rows with a 1 are at the top of this range - this works fine)
I have another bit of code which I need code to copy cells B:L in a row which column A has a "1" in to the first blank row in another sheet. This then generates a number in the second sheet and this number is then copied back into the original sheet in the same row in column M.
When I have fixed ranged I can do this without any problems, but I am trying to do this dynamically as the data entered into B through L will differ everytime the sheet is used.
Can anyone help, here is my NEW code
Dim lr As Long
lr = Sheets("Data Entry").Cells(Rows.Count, "A").End(xlUp).Row
For r = lr To 2 Step 1
If Range("AB" & r).Value = "1" Then
Rows(r).Copy.Range ("A" & lr2 + 1)
Windows("Serialisation Log.xlsx").Activate
Sheets("SNo Log").Select
Range("D" & Rows.Count).End(xlUp).Offset(1).Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
Windows("Serialisation Log.xlsx").Activate
Sheets("SNo Log").Select
Range("A" & Rows.Count).End(xlUp).Offset(-1).Select
Selection.Copy
Range("A" & Rows.Count).End(xlUp).Offset(1).Select
ActiveSheet.Paste
Range("A" & Rows.Count).End(xlUp).Offset(0).Select
Selection.Copy
Windows("Serialisation Generator rev 1.xlsm").Activate
Worksheets("Data Entry").Select
Range("N").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
End If
If Range("AB" & r).Value = "0" Then
Range("I4").Select
ActiveCell.FormulaR1C1 = "Serial No. Issue complete for this OA"
End If
Range("F5").Select
Next r
This seems to run without errors, but doesn't copy or paste anything - any tips or advice. (please note I have changed this question and code massively so the initial answers below may not longer apply.
Any assistance is greatly appreciated.