Paddy1979
Well-known Member
- Joined
- Sep 23, 2005
- Messages
- 608
Please can you help me.
I have this code below running of a button , which makes a user open a certain s'sheet but i want the code to return to cell D8 on the orginal s'sheet but i dont know how to do it, as I cannot use the recorder as the filename may vary which will crash the macro?
Sub Max_Stock()
Dim strFileName As Variant
MsgBox ("Please open the INNS148 S'sheet")
'select file
strFileName = Application.GetOpenFilename(Title:="Open INNS148 Report")
If strFileName = False Then
MsgBox "No File Selected"
Exit Sub
End If
'openfile
Workbooks.OpenText Filename:=strFileName, Origin:=xlMSDOS, _
StartRow:=1, DataType:=xlFixedWidth, FieldInfo:=Array(0, 1)
I have this code below running of a button , which makes a user open a certain s'sheet but i want the code to return to cell D8 on the orginal s'sheet but i dont know how to do it, as I cannot use the recorder as the filename may vary which will crash the macro?
Sub Max_Stock()
Dim strFileName As Variant
MsgBox ("Please open the INNS148 S'sheet")
'select file
strFileName = Application.GetOpenFilename(Title:="Open INNS148 Report")
If strFileName = False Then
MsgBox "No File Selected"
Exit Sub
End If
'openfile
Workbooks.OpenText Filename:=strFileName, Origin:=xlMSDOS, _
StartRow:=1, DataType:=xlFixedWidth, FieldInfo:=Array(0, 1)