Help with VB code please

Smudger

New Member
Joined
Apr 10, 2004
Messages
45
Have tried to use a code posted on this site. I keep getting a " Runtime Error 40036". Code as listed below

Sub CopyThem()
NextRow = Worksheets("Numbers").Range("B65536").End(xlUp).Row + 1
Worksheets("Numbers").Cells(NextRow, 2).Resize(1, 2).Value = Array( _
Worksheets("data").Range("f11").Value, _
Worksheets("data").Range("f12").Value)
End Sub

I am trying to copy data from sheet "Numbers" to sheet "Data"

When I try the code on a blank spread sheet it works fine, but when I try and run it in the existing spreadsheet with existing data I get the error code.

Any Ideas and one ?
 

Excel Facts

What does custom number format of ;;; mean?
Three semi-colons will hide the value in the cell. Although most people use white font instead.
The sheet is called Data.

Is the VB code case sensitive ?

When I debug the error, the line :

NextRow = Worksheets("Numbers").Range("B65536").End(xlUp).Row + 1

is the one that is highlighted.

Don't know if that helps at all.

Do you know what the error "Run-time error 40036 Application-defined or object-defined error" means ?
 
Upvote 0

Forum statistics

Threads
1,203,521
Messages
6,055,885
Members
444,830
Latest member
Excelsmallbusinessmom

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top