ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   macro adjust (https://www.excelbanter.com/excel-worksheet-functions/248712-macro-adjust.html)

MyLan

macro adjust
 
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.

Jacob Skaria

macro adjust
 
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
---------------
Jacob Skaria


"Mylan" wrote:

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.



All times are GMT +1. The time now is 02:35 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com