meakashgfx
New Member
- Joined
- Dec 9, 2014
- Messages
- 33
Here is the code I tried. but it stuck in finding the cell. (Set RangeObj = Cells.find) Please check the following code:
Please help!!!Thanks in Advance.Nazmul Hossain Akash.
Code:
Sub CopyFromFile()Dim MyFile As StringDim erowDim Filepath As StringFilepath = "C:\Users\Nazmul Hossain Akash\Desktop\Play Excel\Final\"MyFile = Dir(Filepath)Do While Len(MyFile) > 0 If MyFile = "zmaster.xlsm" Then Exit Sub End If Workbooks.Open (Filepath & MyFile) Range("B2:D18").Copy Set RangeObj = Cells(1, "A") ActiveWorkbook.Close Set RangeObj = Cells.Find(What:=RangeObj, After:=ActiveCell, _ LookIn:=xlFormulas, LookAt:=xlPart, SearchOrder:=xlByRows, _ SearchDirection:=xlNext, MatchCase:=False) If RangeObj Is Nothing Then MsgBox "Not Found" Else RangeObj.Select ActiveCell.Offset(rowOffset:=2, columnOffset:=0).Activate ActiveSheet.PasteSpecial MyFile = DirLoopEnd Sub