LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,885
Default Reference to a variable in windows(???).Activate

Hi
not testedt but try instead of
source_wks.range("C5:D7").copy
target_wks.paste


source_wks.range("C5:D7").copy
target_wks.paste Destination:=target_wks.range("C5:D7")

or try
source_wks.range("C5:D7").copy Destination:=target_wks.range("C5:D7")

--
Regards
Frank Kabel
Frankfurt, Germany


John Baker wrote:
FranK;

Thank you very much for the useful response. It works finer EXCEPT
for the last line: target_wks.paste

Somehow it appears to want other parameters (range "C5:D7"perhaps) ,
and I am not certain how to set them up. You advice would be
appreciated.

Thanks

John Baker


"Frank Kabel" wrote:

Hi John
in general no need for using Select statements or the names of the
workbooks. Use object references. e.g. try something like

sub foo()
dim source_wbk as workbook
dim source_wks as worksheet
dim target_wkb as workbook
dim target_wks as worksheet
dim installfile

installfile = installpath &/& installname 'adapt to your needs
set target_wbk = activeworkbook
set target_wks = target_wbk.worksheets("Input")
workbooks.open installfile
set source_wbk = activeworkbook
set source_wks=source_wbk.worksheets("Input")

source_wks.range("C5:D7").copy
target_wks.paste
end sub



 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem with =sum(offset(cell reference,w,x,y,z). I want cell reference to be variable [email protected] Excel Worksheet Functions 2 December 11th 04 12:00 AM
using array with Windows().activate NikkoW Excel Programming 1 May 4th 04 03:15 AM
How to activate a file when the filename is represented by a string variable news.sintef.no Excel Programming 4 February 6th 04 02:17 PM
Variable reference John[_44_] Excel Programming 1 August 8th 03 04:53 PM
How can I invoke windows environment variable in excel Bert van den Brink Excel Programming 0 August 6th 03 08:46 PM


All times are GMT +1. The time now is 03:50 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"