ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Run-Time Error (https://www.excelbanter.com/excel-programming/318788-run-time-error.html)

JimFor

Run-Time Error
 
Hi,
I'm working on a programa and am trying to move some data from one sheet in a
workbook to another. I wanted to move the data in seven cells from sheet 1 to
sheet 2 Tried doing it with one cell This is my what my instructions look
like:

Sub MySub()
Worksheets(Sheet2).Cells(2, 1) = Worksheets(Sheet1).Cells(2, 1)
End Sub

When I run it I get a Run-time Error 13 Type Mismatch error

Can anyone tell me what that means and what I can to do correct the error? The
cell format is "General." I have nothing else in the program. Just those
lines.

Thanks

Norman Jones

Run-Time Error
 
Hi JimFor,

If you intend to use the sheet code names, try:

Sheet2.Cells(2, 1),Value = Sheet1.Cells(2, 1).Value

If you intend to use the sheet names, try:

Worksheets("Sheet2").Cells(2, 1).Value = _
Worksheets("Sheet1").Cells(2, 1).Value

---
Regards,
Norman



"JimFor" wrote in message
...
Hi,
I'm working on a programa and am trying to move some data from one sheet
in a
workbook to another. I wanted to move the data in seven cells from sheet
1 to
sheet 2 Tried doing it with one cell This is my what my instructions
look
like:

Sub MySub()
Worksheets(Sheet2).Cells(2, 1) = Worksheets(Sheet1).Cells(2, 1)
End Sub

When I run it I get a Run-time Error 13 Type Mismatch error

Can anyone tell me what that means and what I can to do correct the error?
The
cell format is "General." I have nothing else in the program. Just those
lines.

Thanks




Norman Jones

Run-Time Error
 
Typo warning:

Sheet2.Cells(2, 1),Value = Sheet1.Cells(2, 1).Value


should be:

Sheet2.Cells(2, 1).Value = Sheet1.Cells(2, 1).Value

(the comma preceding the first instance of Value should be a period)


---
Regards,
Norman



"Norman Jones" wrote in message
...
Hi JimFor,

If you intend to use the sheet code names, try:

Sheet2.Cells(2, 1),Value = Sheet1.Cells(2, 1).Value

If you intend to use the sheet names, try:

Worksheets("Sheet2").Cells(2, 1).Value = _
Worksheets("Sheet1").Cells(2, 1).Value




JimFor

Run-Time Error
 
Thanks. I'll try it.


All times are GMT +1. The time now is 12:22 PM.

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