View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
GS[_2_] GS[_2_] is offline
external usenet poster
 
Posts: 3,514
Default Code with hidden flaw ERROR 400

On Thursday, March 28, 2013 6:55:15 PM UTC-7, GS wrote:
Howard,

The InputBox returns a Range object, and so your code has a fully

qualified ref to each range. Sooo...



CpyRngTo.Value = CpyRngFrom.Value



..is all you need.



--

Garry


Hi Garry,

CpyRngTo.Value = CpyRngFrm.Value

Your suggestion work well but copies to the same sheet it is copied
from. Needs to go to the other workbook named Copy WkBook TOO.

The only place the other workbook is mentioned is in the last line of
code. So the problem has to be there but danged if I can see why it
doesn't work.

Howard


This code...

Set CpyRngFrm = Application.InputBox(Prompt:="Enter a Copy FROM
Range.", _
Title:="Enter Copy FROM Range", Type:=8)
If CpyRngFrm Is Nothing Then Exit Sub

...sets a fully qualified ref to the source range. (I'd name it
rngSource) It should also hold a ref to the workbook it belongs to, and
the sheet where the selection was made.

This code...

Set CpyRngTo = Application.InputBox(Prompt:="Enter a Copy TOO Range.",
_
Title:="Enter Copy TOO Range", Type:=8)
If CpyRngTo Is Nothing Then Exit Sub

...sets a fully qualified ref to the target range. (I'd name it
rngTarget) It should also hold a ref to the workbook it belongs to, and
the sheet where the selection was made.

That precludes, then, that you only need to transfer the values between
the variables. If your target range is not in the correct workbook then
that's a user selection issue.

--
Garry

Free usenet access at http://www.eternal-september.org
Classic VB Users Regroup!
comp.lang.basic.visual.misc
microsoft.public.vb.general.discussion