macro adjust

M

Mylan

I am running this macro in a spreadsheet which carries the numerical data
entered in sheet A to Sheet B with (PO) before each entry.
CURRENT MACRO RUNNING(WORKS PROPERLY)

Sub Worksheet_Change(ByVal Target As Range)
Dim zPO As String
Dim u as Integer
If Not Interest(Target, Range("A2:A9999)) Is Nothing Then On Error Resume Next
zPO = "PO" & Right(Target.Value, Len(Target.Value) - 3)
On Error GoTo 0
u = Sheets("Purchase Orders").Range("A65536").End(x1up).Row
Sheets("Purchase Orders").Range("A" & u + 1) = zPO
End If
End Sub

How can I edit this Macro to carry the same information to a third
location(column) in the workbook on a third sheet with VB (Vendor bills) as
the zVB vale.
 
J

Jacob Skaria

Try the below....(not tested)

Sub Worksheet_Change(ByVal Target As Range)
Dim zPO As String,zVB As String, u As Long
If Not Interest(Target, Range("A2:A9999)) Is Nothing Then
On Error Resume Next
zPO = "PO" & Right(Target.Value, Len(Target.Value) - 3)
zVB = "VB" & Right(Target.Value, Len(Target.Value) - 3)
On Error GoTo 0
u = Sheets("Purchase Orders").Range("A65536").End(x1up).Row
Sheets("Purchase Orders").Range("A" & u + 1) = zPO

u = Sheets("Vendor Bills").Range("A65536").End(x1up).Row
Sheets("Vendor Bills").Range("A" & u + 1) = zVB
End If
End Sub

If this post helps click Yes
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top