ClwnMan76
New Member
- Joined
- Oct 26, 2009
- Messages
- 28
- Office Version
- 365
- Platform
- Windows
I'm an idiot or something. I took, what I thought were pretty straight forward directions on here, but it's not working out for me. MISC S1 has a month in it. I get an error no matter what I do with the "Set ws = Sheets(MySheet)" line. I just want that "JUL" to change depending on the cell in S1.
Code:
Sub ImportSixtySecond() Dim Fname As String
Dim SrcWbk As Workbook
Dim DestWbk As Workbook
Dim ws As Worksheet
Dim MySheet As String
Set DestWbk = ThisWorkbook
MySheet = Sheets("MISC").Range("s1").Value
Set ws = Sheets(MySheet)
Fname = Application.GetOpenFilename(FileFilter:="Excel Files (*.xls*), *.xls*", Title:="Select a File")
If Fname = "False" Then Exit Sub
Set SrcWbk = Workbooks.Open(Fname)
Dim answer As Integer
answer = MsgBox("Did You Pick The Correct File?", vbQuestion + vbYesNo)
If answer = vbNo Then Exit Sub
MsgBox "Your Screen APR Look Frozen While Importing." & vbNewLine & vbNewLine & "Just Be Patient!", vbOKCancel + vbQuestion
SrcWbk.Sheets("JUL").Range("b4:ai18").Copy: DestWbk.Sheets("62nd").Range("b4").PasteSpecial xlPasteValuesAndNumberFormats