Results 1 to 6 of 6

Very easy problem : Referencing to a GetOpenFilename sheet

Threaded View

  1. #1
    Valued Forum Contributor
    Join Date
    03-17-2012
    Location
    Warsaw, Poland
    MS-Off Ver
    2007/2010
    Posts
    555

    Very easy problem : Referencing to a GetOpenFilename sheet

    Hi guys,

    I'm having problems with the following code:
    Sub asd()
    
    Dim wB As Workbook
    
    Set wB = Workbook.Open(Application.GetOpenFilename)
        
        ChDrive ("T")
        ChDir ("T:\____M")
    
    AciveSheet.Range("B:B").Delete
    
    Range("C2:AD200").Select
    
    Selection.Replace What:="Immediate ", Replacement:="", LookAt:=xlPart, _
            SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
            ReplaceFormat:=False
    
            Cells.Replace What:="Email ", Replacement:="", LookAt:=xlPart, _
            SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
            ReplaceFormat:=False
            
            Range("A1:I200").Copy
            
            Workbooks("SAR Report V2.xls").Sheets("Original Schedules").Range("B6").PasteSpecial xlPasteValues
            
            wB.Sheets("1").Range("A1:B200, K1:P200").Copy
            
            Workbooks("Sar Report V2.xls").Sheets("Original Schedules").Range("U6").PasteSpecial xlPasteValues
            
            wB.Range("A1:B200, Q1:W200").Copy
            
            Workbooks("Sar Report V2.xls").Sheets("Original Schedules").Range("AN6").PasteSpecial xlPasteValues
            
            wB.Range("A1:B200, X1:AD200").Copy
            
            Workbooks("Sar Report V2.xls").Sheets("Original Schedules").Range("BG6").PasteSpecial xlPasteValues
    
    
    End Sub
    Seems I'm too newb to use a reference to a workbook that was opened with the GetOpenFilename Command :/ Whats the probelm here? I want to chose which file to open and then use a reference to that file (wB) to open/copy etc.

    I get the open new file window, but whatever i select i get a Run-time error '424': Object Required

    Thanks!
    Last edited by Bishonen; 03-23-2012 at 07:03 AM.

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