pedie
Well-known Member
- Joined
- Apr 28, 2010
- Messages
- 3,875
Hi,
Mycode looks in col A but find the like match and then updates..please advice on what I should do to get exact match
I really doubt there is something wrong on the blue line....Is that coded correctly?
I am trying to find ik in A:A and then find "" cell below it and then paste the copied content..
Thanks alot for helping me in Advance
Pedie
Mycode looks in col A but find the like match and then updates..please advice on what I should do to get exact match
I really doubt there is something wrong on the blue line....Is that coded correctly?
I am trying to find ik in A:A and then find "" cell below it and then paste the copied content..
Thanks alot for helping me in Advance
Pedie
Code:
[FONT=Arial]Sub Update()[/FONT]
[FONT=Arial]Application.ScreenUpdating = False[/FONT]
[FONT=Arial]Dim wb As Workbook, MyFile As String[/FONT]
[FONT=Arial]Dim ik As String[/FONT]
[FONT=Arial]ik = ThisWorkbook.Sheets("MyDATA").Range("C4").Value[/FONT]
[FONT=Arial]Sheets("MyDATA").Range("C2:C13").Copy[/FONT]
<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p></o:p>
[FONT=Arial]MyFile = "C:\TRY.xls"[/FONT]
[FONT=Arial] On Error Resume Next[/FONT]
[FONT=Arial] Set wb = Workbooks.Open(Filename:=MyFile)[/FONT]
[FONT=Arial] On Error GoTo 0[/FONT]
[FONT=Arial] If wb Is Nothing Then MsgBox "File not in accessabl…": Exit Sub[/FONT]
[FONT=Arial] Windows("TRY.xls").Activate[/FONT]
[FONT=Arial] Sheets("MAIN").Activate[/FONT]
[FONT=Arial][COLOR=blue] If Not ActiveWorkbook.ActiveSheet.Range("A1:A65500").Find(ik, LookAt:=xlWhole) Is Nothing Then[/COLOR][/FONT]
[FONT=Arial] ActiveCell.Select[/FONT]
[FONT=Arial] Do Until ActiveCell.Value = ""[/FONT]
[FONT=Arial] ActiveCell.Offset(1, 0).Select[/FONT]
[FONT=Arial] Loop[/FONT]
[FONT=Arial] Selection.PasteSpecial Paste:=xlPasteValuesAndNumberFormats, Operation:= _[/FONT]
[FONT=Arial] xlNone, SkipBlanks:=False, Transpose:=True[/FONT]
[FONT=Arial] wb.Close savechanges:=True[/FONT]
[FONT=Arial] ThisWorkbook.Activate[/FONT]
[FONT=Arial] Sheets("MyDATA").Select[/FONT]
[FONT=Arial] Application.CutCopyMode = False[/FONT]
[FONT=Arial] MsgBox "OK"[/FONT]
[FONT=Arial] Else[/FONT]
[FONT=Arial] wb.Close savechanges:=False[/FONT]
[FONT=Arial] ThisWorkbook.Activate[/FONT]
[FONT=Arial] Sheets("MyDATA").Select[/FONT]
[FONT=Arial] Application.CutCopyMode = False[/FONT]
[FONT=Arial] MsgBox ik & " not found...."[/FONT]
[FONT=Arial] End If[/FONT]
[FONT=Arial]Application.ScreenUpdating = True[/FONT]
[FONT=Arial]End sub[/FONT]
<o:p></o:p>
Last edited: