+ Reply to Thread
Results 1 to 1 of 1

Using cell value to open fill and paste into

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    12-16-2006
    Posts
    349

    Using cell value to open fill and paste into


    Private Sub Transfering()
    
       newStatusBar = Application.DisplayStatusBar
       Application.DisplayStatusBar = True
       Application.StatusBar = "Please be patient this macro is transfering data to the manager files..."
    
       Application.ScreenUpdating = False
    
       Dim Rng As Range
       Dim wsD As Worksheet
        
       Set wsD = Workbooks("File Key.xls").Sheets("Input Table")
    
       
       For Each Rng In wsD.Range("iv2:iv" _
       & wsD.Cells(Rows.Count, "iv").End(xlUp).Row)
       
          If Not Rng.Value = vbNullString Then
             wsD.Cells.AutoFilter Field:=17, Criteria1:=Rng.Value
                wsD.Range("A1").CurrentRegion.Copy
            Workbooks.Open Filename:= _
                "P:\CET - aa\bb\cc\Test Folder\" & Rng.Value
             Sheets("FileData").Select
             Range("A1").Select
             ActiveSheet.Paste
             ActiveWorkbook.Close savechanges:=True
             Workbooks("File Key.xls").Activate
             Sheets("Input Table").Select
             Selection.AutoFilter
          End If
       Next Rng
       
       Set wsD = Nothing
       
        Application.ScreenUpdating = True
        Application.StatusBar = False
        Application.DisplayStatusBar = newStatusBar
    
        Sheets("Control").Select
    End Sub

    Hi I need help with this code It is supposed to: look in column IV and using the cell values filter in column 17. then it supposed to select Current Region A1 and copy it which it does, then it supposed open a file using the cell value in iV for which it has filtered for which it does, then it is supposed to select FileData sheet on that file it has opened and select range a1 which it does, then it is supposed to paste the data which it doesnt. I have followed it set by step. When I open the file using the cell value in IV for which it has filtered it loses the info on the clipboard ( the pasted info) can anyone help !¬!!!

    error message

    Paste Method of Worksheet Class Failed
    Last edited by khalid79m; 07-21-2007 at 08:13 AM.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1