F
Full Monty
Excel 97 - Have code to get values from a closed workbook.
Once completed I want a Message Box to appear asking if you want t
view the data. If you select Yes it should open up a hidden page. I
you slect No it should move to another page.
I have worked with Msg Boxes a little but am not sure what I am doin
wrong! Keep getting error messages. Here's the code I currently have.
Sub Importmonday()
GetValuesFromAClosedWorkbook "C:\Data", "Day 1.xls", _
"Sheet1", "AX100:BR1977"
End Sub
Sub GetValuesFromAClosedWorkbook(fPath As String, _
fName As String, sName, cellRange As String)
With ActiveSheet.Range(cellRange)
.FormulaArray = "='" & fPath & "\[" & fName & "]" _
& sName & "'!" & cellRange
.Value = .Value
End With
Answer = MsgBox("Do you want to view Rosters?", _
vbYesNo + vbQuestion, "Rosters Imported!")
If Answer = vbYes Then
Sheets("Today").Select
Exit Sub
If Answer = vbYes Then
Sheets("Timeline").Visible = True
Sheets("Timeline").Select
End Sub
While I am fairly new to VBA, I know a little and can't figure out wha
to correct!
Thanks
Once completed I want a Message Box to appear asking if you want t
view the data. If you select Yes it should open up a hidden page. I
you slect No it should move to another page.
I have worked with Msg Boxes a little but am not sure what I am doin
wrong! Keep getting error messages. Here's the code I currently have.
Sub Importmonday()
GetValuesFromAClosedWorkbook "C:\Data", "Day 1.xls", _
"Sheet1", "AX100:BR1977"
End Sub
Sub GetValuesFromAClosedWorkbook(fPath As String, _
fName As String, sName, cellRange As String)
With ActiveSheet.Range(cellRange)
.FormulaArray = "='" & fPath & "\[" & fName & "]" _
& sName & "'!" & cellRange
.Value = .Value
End With
Answer = MsgBox("Do you want to view Rosters?", _
vbYesNo + vbQuestion, "Rosters Imported!")
If Answer = vbYes Then
Sheets("Today").Select
Exit Sub
If Answer = vbYes Then
Sheets("Timeline").Visible = True
Sheets("Timeline").Select
End Sub
While I am fairly new to VBA, I know a little and can't figure out wha
to correct!
Thanks