ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   strange "subscript out of range" error! (https://www.excelbanter.com/excel-programming/291576-strange-subscript-out-range-error.html)

behnood

strange "subscript out of range" error!
 
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

--
Message posted from http://www.ExcelForum.com


patrick molloy

strange "subscript out of range" error!
 
Workbooks("program").WorkSheets("sheet2").Range("A 1") =
Workbooks("cost price phase one").Worksheets(1).Range
("A1") ).Value

Patrick Molloy
Microsoft Excel MVP

Destination:=Workbooks("program").Sheets("sheet2" ).Cells

(1, 1)
-----Original Message-----
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 click
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).Copy
Destination:=Workbooks("program").Sheets("sheet2" ).Cells

(1, 1)

any idea?
regards
Reza Behnood


---
Message posted from http://www.ExcelForum.com/

.


behnood[_2_]

strange "subscript out of range" error!
 
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


behnood[_2_]

strange "subscript out of range" error!
 
problem solved
i must use file names with extension (program.xls) insteed of (program
thank



All times are GMT +1. The time now is 04:21 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com