I have data in two columns A(Barcode) & B(count). I need a macro that copies data from Column A and paste it in notepad multiple times as mentioned in column B. Below is my code that works well for only selected row. Please help to create a loop so the macro works till last row containing data: Sample Data
Sub Receivinggg()
Dim obj As New DataObject
Dim bc As Variant
Dim i As Integer
Dim j As Integer
j = Cells(ActiveCell.Row, 2).Value
For i = 1 To j
bc = Selection.Value
If Len(bc) < 11 Then
bc = "0" & Selection.Value
End If
obj.SetText bc
obj.PutInClipboard
VBA.AppActivate ("1 - Notepad"), 0
SendKeys "+{INSERT}"
Application.Wait Now + TimeValue("00:00:02")
SendKeys "{Enter}"
Next i
VBA.AppActivate ("Receiving - Excel"), 0
SendKeys "{Down}"
End Sub