Subject: Command Button Question
Posted By: eoghang Post Date: 9/24/2006 11:17:19 AM
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.




Reply By: vemaju Reply Date: 9/25/2006 2:36:30 AM
Hi,

Set your code
Rows("1:6").Select
like this
ActiveSheet.Rows("1:6").Select

-vemaju
Reply By: eoghang Reply Date: 9/25/2006 8:33:24 PM
Vemaju; Thank you this helped.


Go to topic 50233

Return to index page 165
Return to index page 164
Return to index page 163
Return to index page 162
Return to index page 161
Return to index page 160
Return to index page 159
Return to index page 158
Return to index page 157
Return to index page 156