R
Robert
Am using the following code (amended to suit my need)
by gwengrofsky in this ng. Requesting help to modify code so
that (1) read data starts at B2 or other row (instead of col A)
and write starts at B2 (instead of col A) (2) target sheet not be
cleared before each execution but records be added in
sequence (3) Source workbook will vary always therefore
have to refer as ActiveWorkbook. Have seen Ron’s
codes but unable to fix (no VBA knowledge).
Thank you in advance for those trying.
Sub RtoUCopy()
Dim Var1 As Variant
Dim Var2 As Variant
Dim Var3 As Variant
Dim Var4 As Variant
Dim Var5 As Variant
Dim Var6 As Variant
Dim Var7 As Variant
Dim Var8 As Variant
Dim Var9 As Variant
Dim Var10 As Variant
Dim Var11 As Variant
Dim Var12 As Variant
Dim Var13 As Variant
Dim Var14 As Variant
Dim Var15 As Variant
Dim Var16 As Variant
Dim Var17 As Variant
Dim Var18 As Variant
Dim Var19 As Variant
Dim Var20 As Variant
Dim Var21 As Variant
Dim Var22 As Variant
Dim Var23 As Variant
Dim Var24 As Variant
Dim Var25 As Variant
Dim Var26 As Variant
Dim RowR As Integer
Dim RowU As Integer
' Both workbooks need to be open first. Cell A2 must be st'art
'of data.
RowR = 2
RowU = 2
Application.Workbooks("Register.xls").Worksheets(1).Activate
Do While Not IsEmpty(Cells(RowR, 1))
Var24 = Cells(RowR, 24)
If LCase(Var24) = "out" Then
Var1 = Cells(RowR, 1)
Var2 = Cells(RowR, 2)
Var3 = Cells(RowR, 3)
Var4 = Cells(RowR, 4)
Var6 = Cells(RowR, 6)
Var8 = Cells(RowR, 8)
Var9 = Cells(RowR, 9)
Var10 = Cells(RowR, 10)
Var11 = Cells(RowR, 11)
Var12 = Cells(RowR, 12)
Var15 = Cells(RowR, 15)
Var16 = Cells(RowR, 16)
Var17 = Cells(RowR, 17)
Application.Workbooks("Update.xls").Worksheets(1).Activate
Cells(RowU, 1) = Var1
Cells(RowU, 2) = Var2
Cells(RowU, 3) = Var3
Cells(RowU, 4) = Var4
Cells(RowU, 5) = Var6
Cells(RowU, 6) = Var8
Cells(RowU, 7) = Var9
Cells(RowU, 8) = Var10
Cells(RowU, 9) = Var11
Cells(RowU, 10) = Var15
Cells(RowU, 11) = Var16
Cells(RowU, 12) = Var17
Cells(RowU, 13) = Var24
RowU = RowU + 1
Application.Workbooks("Register.xls").Worksheets(1).Activate
End If
RowR = RowR + 1
Loop
End Sub
by gwengrofsky in this ng. Requesting help to modify code so
that (1) read data starts at B2 or other row (instead of col A)
and write starts at B2 (instead of col A) (2) target sheet not be
cleared before each execution but records be added in
sequence (3) Source workbook will vary always therefore
have to refer as ActiveWorkbook. Have seen Ron’s
codes but unable to fix (no VBA knowledge).
Thank you in advance for those trying.
Sub RtoUCopy()
Dim Var1 As Variant
Dim Var2 As Variant
Dim Var3 As Variant
Dim Var4 As Variant
Dim Var5 As Variant
Dim Var6 As Variant
Dim Var7 As Variant
Dim Var8 As Variant
Dim Var9 As Variant
Dim Var10 As Variant
Dim Var11 As Variant
Dim Var12 As Variant
Dim Var13 As Variant
Dim Var14 As Variant
Dim Var15 As Variant
Dim Var16 As Variant
Dim Var17 As Variant
Dim Var18 As Variant
Dim Var19 As Variant
Dim Var20 As Variant
Dim Var21 As Variant
Dim Var22 As Variant
Dim Var23 As Variant
Dim Var24 As Variant
Dim Var25 As Variant
Dim Var26 As Variant
Dim RowR As Integer
Dim RowU As Integer
' Both workbooks need to be open first. Cell A2 must be st'art
'of data.
RowR = 2
RowU = 2
Application.Workbooks("Register.xls").Worksheets(1).Activate
Do While Not IsEmpty(Cells(RowR, 1))
Var24 = Cells(RowR, 24)
If LCase(Var24) = "out" Then
Var1 = Cells(RowR, 1)
Var2 = Cells(RowR, 2)
Var3 = Cells(RowR, 3)
Var4 = Cells(RowR, 4)
Var6 = Cells(RowR, 6)
Var8 = Cells(RowR, 8)
Var9 = Cells(RowR, 9)
Var10 = Cells(RowR, 10)
Var11 = Cells(RowR, 11)
Var12 = Cells(RowR, 12)
Var15 = Cells(RowR, 15)
Var16 = Cells(RowR, 16)
Var17 = Cells(RowR, 17)
Application.Workbooks("Update.xls").Worksheets(1).Activate
Cells(RowU, 1) = Var1
Cells(RowU, 2) = Var2
Cells(RowU, 3) = Var3
Cells(RowU, 4) = Var4
Cells(RowU, 5) = Var6
Cells(RowU, 6) = Var8
Cells(RowU, 7) = Var9
Cells(RowU, 8) = Var10
Cells(RowU, 9) = Var11
Cells(RowU, 10) = Var15
Cells(RowU, 11) = Var16
Cells(RowU, 12) = Var17
Cells(RowU, 13) = Var24
RowU = RowU + 1
Application.Workbooks("Register.xls").Worksheets(1).Activate
End If
RowR = RowR + 1
Loop
End Sub