Run-Time Error

  • Thread starter Thread starter JimFor
  • Start date Start date
J

JimFor

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
 
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
 
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)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top