Hello, I am using the following code to sort data in a WS and copy it over to another WS. It all works just fine but I was thinking that I would like to limit it the first "X" numbers of rows so that my second WS doesn't get too big - lets say the first 5 entries. So I am thinking that I want to put a counter on each time it copies, and limit that number in End If statement. Is that the way to do it? I tried a couple of things but I can't tell if I am using the wrong syntax or if I am just wrong in the first place - I always appreciate your input.
I really try to do this on my own before I bug you all with it .
I really try to do this on my own before I bug you all with it .
VBA Code:
Sub CopyEpipro()
Dim c As Range
Dim j As Integer
Dim Source As Worksheet
Dim Target As Worksheet
Dim setpoint As Integer
Set Source = ActiveWorkbook.Worksheets("EPIPRO")
Set Target = ActiveWorkbook.Worksheets("Export")
setpoint = ActiveWorkbook.Worksheets("Coding").Range("C2")
j = 45 ' Start copying to row # in target sheet
For Each c In Source.Range("H5:H120") ' The column for the micron reading
If c >= setpoint Then
Source.Rows(c.Row).Copy Target.Rows(j)
j = j + 1
End If
Next c
End Sub