Results 1 to 3 of 3

Thread: Simple code help an old man
Thanks Thanks: 0 Likes Likes: 0

  1. #1
    Board Regular
    Join Date
    Feb 2016
    Posts
    217
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Simple code help an old man

    HI There

    M steps fr my code are:

    Code:
    Sub GET_IOR_DIAGNOSTIC_DATA()
    'OPEN FOLDER
    Dim myfile As String
    
    On Error GoTo 100
    Dir "I:\Blenheim House\Analytics\North Region Report Library\StEIS\STEIS Tool"
    
    myfile = Application.GetOpenFilename
    Workbooks.Open (myfile)
    100: Exit Sub
    
    'MSGBOX SELECT FILE
    
    MsgBox "please select your file"
    
    
    'AFTER OPEN,  SELECT FROM the 3 seperate drop downs: NORTH, STP, AND THEn for the last drop down MATCH THE SELECTION ON my sheet
    
    'GO TO THE CCG SHEET AND COPY
    ActiveWorkbook.Sheets("sheetname").Select
    Cells("a1:s28").Copy
    
    
    'CLOSE THE SHEET but keep clipboard
    ActiveWorkbook.Close
    Application.CutCopyMode = False
    
    
    'GO TO OUR SHEET AND PASTE
    Workbook("myworkbook").Activate
    Sheets("my sheet").Select
    Cells("a1").Activate
    ActiveCell.Paste
    
    'END
    I have no idea how to open simple folder the open the selected file, i tried changing it to chdir but it does not help.
    thks

  2. #2
    Board Regular
    Join Date
    Jun 2011
    Posts
    1,399
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Re: Simple code help an old man

    Can you open the file directly without opening the folder? Something like:

    Code:
    Dim wb As Workbook
    
    set wb = Workbooks.Open(Filename:=mypath & "\" & myfile)
    Excel 2010, Windows 10

  3. #3
    Board Regular
    Join Date
    Feb 2016
    Posts
    217
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Re: Simple code help an old man

    Quote Originally Posted by yky View Post
    Can you open the file directly without opening the folder? Something like:

    Code:
    Dim wb As Workbook
    
    set wb = Workbooks.Open(Filename:=mypath & "\" & myfile)
    Hi

    the filename changes every month. need to just open the folder any ideas? I also need to know how to change the option froma drop down menu based on a value in my

Some videos you may like

User Tag List

Tags for this Thread

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

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