Hi All,
Here is my working codes & I am trying to create a sub that can be called from another sub that has different value of (i).
Any one can help on this?
Sub Inv()
Dim i, j As Integer
i = 18
j = i + 2
SendKeys "%{TAB}", True
Application.Wait (Now + TimeValue("00:00:01"))
For i = 18 To j
'Account
ActiveSheet.Cells(i, 12).Copy
SendKeys "^v", True
Application.Wait (Now + TimeValue("00:00:01"))
SendKeys "{TAB}", True
Application.Wait (Now + TimeValue("00:00:01"))
'Amount
ActiveSheet.Cells(i, 13).Copy
SendKeys "^v", True
Application.Wait (Now + TimeValue("00:00:01"))
SendKeys "{TAB}", True
Application.Wait (Now + TimeValue("00:00:01"))
'Description
ActiveSheet.Cells(i, 14).Copy
SendKeys "^v", True
Application.Wait (Now + TimeValue("00:00:01"))
If j - i <> 0 Then
'Move to Next Line
SendKeys "{DOWN}", True
Application.Wait (Now + TimeValue("00:00:01"))
SendKeys "{TAB}", True
Application.Wait (Now + TimeValue("00:00:01"))
End If
Next i
End Sub
Here is my working codes & I am trying to create a sub that can be called from another sub that has different value of (i).
Any one can help on this?
Sub Inv()
Dim i, j As Integer
i = 18
j = i + 2
SendKeys "%{TAB}", True
Application.Wait (Now + TimeValue("00:00:01"))
For i = 18 To j
'Account
ActiveSheet.Cells(i, 12).Copy
SendKeys "^v", True
Application.Wait (Now + TimeValue("00:00:01"))
SendKeys "{TAB}", True
Application.Wait (Now + TimeValue("00:00:01"))
'Amount
ActiveSheet.Cells(i, 13).Copy
SendKeys "^v", True
Application.Wait (Now + TimeValue("00:00:01"))
SendKeys "{TAB}", True
Application.Wait (Now + TimeValue("00:00:01"))
'Description
ActiveSheet.Cells(i, 14).Copy
SendKeys "^v", True
Application.Wait (Now + TimeValue("00:00:01"))
If j - i <> 0 Then
'Move to Next Line
SendKeys "{DOWN}", True
Application.Wait (Now + TimeValue("00:00:01"))
SendKeys "{TAB}", True
Application.Wait (Now + TimeValue("00:00:01"))
End If
Next i
End Sub