LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 113
Default Copy marked records from Workbook to Workbook

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 Rons
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

--
Robert
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Excel-how to link source workbook to copy of destination workbook D Lynn Excel Worksheet Functions 1 May 29th 08 05:36 PM
Can't open Excel workbook. Marked " cannot be accessed. Ron Excel Discussion (Misc queries) 0 May 30th 06 02:34 PM
loop through a column on a workbook copying data on each row to another workbook, then copy data back to the original workbook burl_rfc Excel Programming 1 April 1st 06 08:48 PM
Copy a range of cells in an unopened workbook and paste it to the current workbook topstar Excel Programming 3 June 24th 04 12:50 PM


All times are GMT +1. The time now is 08:25 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"