Hi people,
i am writing a simple macro in excel but i don't know what i am doin wrong.
here is the thing i wanted to do,
open a file (temp.xls) and manipluate some cell data. i created a button in a file and inputed following code
Private Sub CBopen_Click()
Workbooks.Open Filename:="C:\temp.xls"
Workbooks("temp.xls"
.Activate
Worksheets("sheet1"
.Activate
Range("E10"
.Select
ActiveCell.FormulaR1C1 = "=RC[-3]-5"
Range("F10"
.Select
ActiveCell.FormulaR1C1 = "=RC[-3]*100"
Range("E10:F10"
.Select
End Sub
but it gives error saying "select method of Range class failed" ( its giving error at "Range("E10"
.Select "
.
i think i am not able to point excel to right workbook.
thanks in advance for the help.
regards
karen
i am writing a simple macro in excel but i don't know what i am doin wrong.
here is the thing i wanted to do,
open a file (temp.xls) and manipluate some cell data. i created a button in a file and inputed following code
Private Sub CBopen_Click()
Workbooks.Open Filename:="C:\temp.xls"
Workbooks("temp.xls"
Worksheets("sheet1"
Range("E10"
ActiveCell.FormulaR1C1 = "=RC[-3]-5"
Range("F10"
ActiveCell.FormulaR1C1 = "=RC[-3]*100"
Range("E10:F10"
End Sub
but it gives error saying "select method of Range class failed" ( its giving error at "Range("E10"
i think i am not able to point excel to right workbook.
thanks in advance for the help.
regards
karen