View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Mike H Mike H is offline
external usenet poster
 
Posts: 11,501
Default Subscript out of Range problem Copy Cell from one workbook to anot

Hi,

Untested but try it like this. Note I think it's a bad idea to copy the
unqualified
range("E1")
You would be better qualifying that range along the lines of

Activeworkbook.sheets("Sheet1").range("E1").copy

Sub Rectangle6()
Range("E1").Copy
Workbooks.Open Filename:="J:\Dummy Rates.xls", UpdateLinks:=3
Sheets("ITS GB").Range("G5").PasteSpecial _
Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
End Sub
--
Mike

When competing hypotheses are otherwise equal, adopt the hypothesis that
introduces the fewest assumptions while still sufficiently answering the
question.


"james" wrote:

Hi I have a spreadsheet called MasterSheet.xls
In this sheet is a button with the code below attached. On clicking the
button it should copy cell E1 in "Mastersheet.xls" (which it does) and copy
the value into spreadsheet called "Dummy Rates.xls" under Sheet "ITS GB"
However it comes up with an Error saying 'Subscript out of Range'. If I take
out the line 'Sheets("ITS GB").Select' Then the code works but will only
paste in the active sheet.
Any ideas?

Cheers


Sub Rectangle6()
Range("E1").Select
Selection.Copy
Workbooks.Open Filename:= _
"J:\Dummy Rates.xls" _
, UpdateLinks:=3
Sheets("ITS GB").Select
Range("G5").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
End Sub