Command Button Question
Question from a newbie.
I've created code and debugged it successfully as part of a worksheet object. But when I copied the code to a command button it gives a run-time error. Why can't I simply copy the code from the worksheet to the command button?
It fails at:
Rows("1:6").Select
and gives the reason as 'Select method of Range class failed.'
Here are the few lines of code before this line:
'
ChDir "D:\"
Workbooks.Open Filename:="D:\Export.csv"
' Activate export.csv
Windows("Export.csv").Activate
' Modify the contents of the file
Rows("1:6").Select
Thank you in advance for your help.
|