PC Review


Reply
Thread Tools Rate Thread

Actively select cells/ranges/sheets and Paste Link

 
 
pl_hlp
Guest
Posts: n/a
 
      6th Jun 2010
Hello:

What I am trying to do is select the cells or range on a sheet that I am
interested in, then paste link on a different sheet. All the selections
should be variable (I mean not be hardcoded).

Thanks,

pl_hlp
 
Reply With Quote
 
 
 
 
Gary''s Student
Guest
Posts: n/a
 
      6th Jun 2010
Something like this:

Sub YetAnotherTry()
Dim r1 As Range, r2 As Range
Set r1 = Application.InputBox(prompt:="select copy area", Type:=8)
ady1 = r1.Address

Sheets("Sheet2").Select
Set r2 = Application.InputBox(prompt:="select destination cell", Type:=8)
ady2 = r2.Address

Sheets("sheet1").Select
Range(ady1).Select
Selection.Copy
Sheets("Sheet2").Select
Range(ady2).Select
ActiveSheet.Paste Link:=True
End Sub

--
Gary''s Student - gsnu201004


"pl_hlp" wrote:

> Hello:
>
> What I am trying to do is select the cells or range on a sheet that I am
> interested in, then paste link on a different sheet. All the selections
> should be variable (I mean not be hardcoded).
>
> Thanks,
>
> pl_hlp

 
Reply With Quote
 
pl_hlp
Guest
Posts: n/a
 
      6th Jun 2010
Hi Gary's Student:

Thank you for your help. I played with the codes. The codes meet some of my
objectives. I am wondering if we can make them smarter. The selection range
is on a variable sheet (not hardcoded to "Sheet 1") and the destination is on
another variable sheet (not hard coded to "Sheet 2"). Further, when we copy
"Plaste Link", the sequence of destination cells is not the same as the
origin cells. The destination cells will be as per a prefined sequence. Let
me explain this a little bit. The origin cells are selected from 8
consecutive cells on a column. When we Paste Link, the destination cells will
in 2 by 4 cells.

Thanks,

pl_hlp




"Gary''s Student" wrote:

> Something like this:
>
> Sub YetAnotherTry()
> Dim r1 As Range, r2 As Range
> Set r1 = Application.InputBox(prompt:="select copy area", Type:=8)
> ady1 = r1.Address
>
> Sheets("Sheet2").Select
> Set r2 = Application.InputBox(prompt:="select destination cell", Type:=8)
> ady2 = r2.Address
>
> Sheets("sheet1").Select
> Range(ady1).Select
> Selection.Copy
> Sheets("Sheet2").Select
> Range(ady2).Select
> ActiveSheet.Paste Link:=True
> End Sub
>
> --
> Gary''s Student - gsnu201004
>
>
> "pl_hlp" wrote:
>
> > Hello:
> >
> > What I am trying to do is select the cells or range on a sheet that I am
> > interested in, then paste link on a different sheet. All the selections
> > should be variable (I mean not be hardcoded).
> >
> > Thanks,
> >
> > pl_hlp

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Huge problem with comparing cells in different ranges and sheets =?Utf-8?B?TW9ub3hpdG8=?= Microsoft Excel Programming 8 25th Sep 2007 01:08 PM
Copy paste ranges from multiple sheets Woody1313 Microsoft Excel Programming 2 30th Jan 2006 03:37 PM
in charting, how do i select data ranges from multiple sheets, sa. =?Utf-8?B?bWljaGFlbA==?= Microsoft Excel Charting 1 6th Mar 2005 03:01 PM
cut and paste variabe ranges in one sheet to different sheets in workbook philaugust2004 Microsoft Excel Programming 2 4th Aug 2004 10:26 PM
select ranges of cells relative to location and then paste Buffyslay Microsoft Excel Programming 3 22nd Jun 2004 05:00 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 10:57 PM.