JKB
07-09-2014, 04:47 AM
Hi everybody.
First of all ill warn you that im new in this VBA-world!
My problem is that i have opened a text file, using the code:
Workbooks.OpenText Environ("Userprofile") & "\Documents\VBA halløj\IBM_TAQ", comma:=True
This command opens a new workbook called "IBM_TAQ". This is problematic for me since when i use "range" it selects the cells in the worksheet WITH the button i.e not the in-loaded textfile.
Does anybody know either how i can: Make excel open the document in the same worksheet where i placed the button to activate the code? (I would prefer a solution where the "Opentext" is used.)
Or how i activate the sheet "IBM_TAQ" instead so that i can use the "range command" in the correct workbook?
Hope somebody can help me!
JKB
First of all ill warn you that im new in this VBA-world!
My problem is that i have opened a text file, using the code:
Workbooks.OpenText Environ("Userprofile") & "\Documents\VBA halløj\IBM_TAQ", comma:=True
This command opens a new workbook called "IBM_TAQ". This is problematic for me since when i use "range" it selects the cells in the worksheet WITH the button i.e not the in-loaded textfile.
Does anybody know either how i can: Make excel open the document in the same worksheet where i placed the button to activate the code? (I would prefer a solution where the "Opentext" is used.)
Or how i activate the sheet "IBM_TAQ" instead so that i can use the "range command" in the correct workbook?
Hope somebody can help me!
JKB