Hi, This is the codes i have done, so far the result that i wanted to be was successfull. Is there any simple solution that would give the same result with my requirements? thanks.

Below is my vba macro code

first query
        'Evaluate the rows
        If ws.Range("B199").Value <> "" Then
            MsgBox "All rows have been used!", vbExclamation
            Exit Sub
        End If
        
        If TargetRow + SourceRow - 3 > 200 Then
            MsgBox "Not enough free rows!", vbExclamation
            Exit Sub
        End If
        If TargetRow < 1 Then TargetRow = 1
        
        ws.Range("A" & TargetRow).Offset(1, 0).CopyFromRecordset rec


      second query
        If ws.Range("B399").Value <> "" Then
            MsgBox "All rows have been used!", vbExclamation
            Exit Sub
        End If
        
        If TargetRow + SourceRow - 3 > 399 Then
            MsgBox "Not enough free rows!", vbExclamation
            Exit Sub
        End If
        If TartgetRow < 200 Then TargetRow = 200
        
        ws.Range("A" & TargetRow).Offset(1, 0).CopyFromRecordset rec