Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I'm trying to copy data from one worksheet to another. In the first sheet, there is an ID. I want to find that ID in the second worksheet, and if that ID is found, copy a data into the first sheet. Here is the code I have so far, though it doesn't work. Any help would be greatly appreciated =
Public Sub DateCopy( Dim x As Intege Dim tempvar As Strin Dim tempvar2 As Strin Dim i As Intege Dim xlapp1 As Workshee Dim xlapp2 As Workshee Set xlapp1 = Workbooks("blah.xls").Worksheets("texting" Set xlapp2 = Workbooks("blah2.xls").Worksheets("texting2" For i = 2 To 554 'Application.ScreenUpdating = Fals 'For i = 2 To 200 Set c = Nothin xlapp1.Activat xlapp1.Application.Goto reference:=Rows(i).Columns("A" tempvar = xlapp1.Application.ActiveCell.FormulaR1C With xlapp2.Range("a1:a2000" Set c = .Find(what:=tempvar, MatchCase:=True End Wit If c Is Nothing The Els xlapp2.Activat x = xlapp2.Application.ActiveCell.Ro ' xlapp2.Application.Goto reference:=Rows(x).Columns("C" ' tempvar2 = xlapp2.Application.Selectio MsgBox tempvar xlapp2.Rows(x).Columns("D").FormulaR1C1 = "Yes xlapp1.Rows(i).Columns("D").FormulaR1C1 = tempvar ' tempvar2 = xlapp2.Rows(Application.ActiveCell.Row).Columns("C ").FormulaR1C ' xlapp2.Rows(Application.ActiveCell.Row).Columns("D ").FormulaR1C1 = "Yes ' xlapp1.Rows(i).Columns("D") = tempvar End I Nex Application.ScreenUpdating = Tru End Sub |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
copy from B worksheet to A worksheet with NO repeated data | Excel Discussion (Misc queries) | |||
copy data in a cell from worksheet A to worksheet B | Excel Discussion (Misc queries) | |||
Copy data into a NEW worksheet | Excel Discussion (Misc queries) | |||
Copy Modified Worksheet 1 Data to Worksheet 2 | Excel Programming | |||
copy all worksheet data into a new worksheet | Excel Programming |