strange "subscript out of range" error!

  • Thread starter Thread starter behnood
  • Start date Start date
B

behnood

hi
i have 3 workbooks:

program.xls
cost price phase one.xls
po payment.xls

i sheet1 of program i have a command button and i want when user clic
it some code execute.
but i get "subsript out of range error" and i can't undrestand why!

here is the line og code that vba stop on it during the execution:

Workbooks("cost price phase one").Worksheets(1).Cells(1, 2).Cop
Destination:=Workbooks("program").Sheets("sheet2").Cells(1, 1)

any idea?
regards
Reza Behnoo
 
Workbooks("program").WorkSheets("sheet2").Range("A1") =
Workbooks("cost price phase one").Worksheets(1).Range
("A1") ).Value

Patrick Molloy
Microsoft Excel MVP
 
no differences
by the way i used copy method cause i want cell be copied with all value and forma
i changed my code to what you wrote but again there is subscription out of range error(9
 
problem solved
i must use file names with extension (program.xls) insteed of (program
thank
 
Back
Top