VB error

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am trying to write some simple code to cope/paste some cells into another
workbook, here is what I have so far..

Sub copy_new_entry_data()
Application.ScreenUpdating = False
Range("G9:G15").copy
Sheets("database").Select

End Sub

when I try and run this I get an error
"Sunscript out of range"

what does that meen ????

thanks
 
That suggests that you do not have a sheet called database. Check the
spelling, and if the sheet has a trailing space.
 
Anthony

First of all, do you have a sheet named database?

If not, you would get the "subscript out of range" error.

Secondly, it is rarely necessary to select anything.

Sub copy_to_other_sheet()
Sheets("Sheet2").Range("G9:G15").Copy _
Destination:=Sheets("database").Range("A1")
'or use Activesheet.Range("G9:G15").Copy _
' Destination:=Sheets("database").Range("A1")
End Sub


Gord Dibben Excel MVP
 
I'd guess you don't have a worksheet named database in that active workbook.

Look for extra spaces -- leading or trailing (or transposed characters)
 
Back
Top