Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Copy cells and paste to an address given in another cell (VBA Newbie)


Can anyone help with this problem. I am trying write a macro to copy
range of cells on one worksheet, then goto an address which i
specified in a cell. (This address is dynamic and changes according t
the date) The data can then be copied to the new location. I a
attaching a bitmap image of my example.

Here are my required actions:
Go to cell B27-B33 on worksheet "Entry Sheet"
Copy cells B27-B33
Go To the address in cell B20 (in this case Data!J29)
Paste the copied cell

Thanks in anticipation

Ro

+-------------------------------------------------------------------
|Filename: DataCopyExample.doc
|Download: http://www.excelforum.com/attachment.php?postid=3928
+-------------------------------------------------------------------

--
WightRo
-----------------------------------------------------------------------
WightRob's Profile: http://www.excelforum.com/member.php...fo&userid=1379
View this thread: http://www.excelforum.com/showthread.php?threadid=47801

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 414
Default Copy cells and paste to an address given in another cell (VBANewbie)

Maybe like this:

Sub CopyIt()
Dim CTo As Range
Dim CRng As String
CRng = Sheets("Entry Sheet").Range("B20").Value
Set CTo = Sheets(Left(CRng, InStr(1, CRng, "!") - 1)). _
Range(Right(CRng, Len(CRng) - InStr(1, CRng, "!")))
Sheets("Entry Sheet").Range("B27:B33").Copy CTo
End Sub

Hope this helps
Rowan

WightRob wrote:
Can anyone help with this problem. I am trying write a macro to copy a
range of cells on one worksheet, then goto an address which is
specified in a cell. (This address is dynamic and changes according to
the date) The data can then be copied to the new location. I am
attaching a bitmap image of my example.

Here are my required actions:
Go to cell B27-B33 on worksheet "Entry Sheet"
Copy cells B27-B33
Go To the address in cell B20 (in this case Data!J29)
Paste the copied cell

Thanks in anticipation

Rob


+-------------------------------------------------------------------+
|Filename: DataCopyExample.doc |
|Download: http://www.excelforum.com/attachment.php?postid=3928 |
+-------------------------------------------------------------------+

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Copy cells and paste to an address given in another cell (VBA Newbie)


Thanks Rowan,

That did the trick.

Rob

:

--
WightRo
-----------------------------------------------------------------------
WightRob's Profile: http://www.excelforum.com/member.php...fo&userid=1379
View this thread: http://www.excelforum.com/showthread.php?threadid=47801

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Copy cells and paste to an address given in another cell (VBA Newbie)


As I said in my last post, the problem was solved. Unfortunately that
was only with my simplfied example.

In my actual workbook, the values in the range B27:B33 are fed in from
a calculator sheet. Rowan's code is copying the actual cell data,
which is now setting up a link to the calculator sheet. What I need is
a "Paste Special" = Value, rather that a simple "Paste", is this
possible?

I am new to VBA coding, so all help is appreciated.

Rob


--
WightRob
------------------------------------------------------------------------
WightRob's Profile: http://www.excelforum.com/member.php...o&userid=13799
View this thread: http://www.excelforum.com/showthread...hreadid=478016

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 414
Default Copy cells and paste to an address given in another cell (VBANewbie)

Hi Rob

Try:

Sub CopyIt()
Dim CTo As Range
Dim CRng As String
CRng = Sheets("Entry Sheet").Range("B20").Value
Set CTo = Sheets(Left(CRng, InStr(1, CRng, "!") - 1)). _
Range(Right(CRng, Len(CRng) - InStr(1, CRng, "!")))
Sheets("Entry Sheet").Range("B27:B33").Copy
CTo.PasteSpecial Paste:=xlPasteValues
Application.CutCopyMode = False
End Sub

Regards
Rowan

WightRob wrote:
As I said in my last post, the problem was solved. Unfortunately that
was only with my simplfied example.

In my actual workbook, the values in the range B27:B33 are fed in from
a calculator sheet. Rowan's code is copying the actual cell data,
which is now setting up a link to the calculator sheet. What I need is
a "Paste Special" = Value, rather that a simple "Paste", is this
possible?

I am new to VBA coding, so all help is appreciated.

Rob


Reply
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
Copy/Paste Formula-dropping 1st cell address kesitton Excel Discussion (Misc queries) 1 March 30th 10 08:30 PM
Need code to copy and paste based on cell address. GoBow777 Excel Discussion (Misc queries) 1 July 13th 08 07:24 AM
Copy/Paste Hyperlink Address Bonnie Excel Discussion (Misc queries) 7 January 14th 07 09:42 PM
How can I copy/paste a hyperlink address without the link? voluptas Excel Discussion (Misc queries) 1 May 30th 06 04:16 AM
Copy & Paste Hyperlink address into cell Ron van Oijen Excel Programming 13 May 17th 04 07:09 AM


All times are GMT +1. The time now is 11:48 PM.

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

About Us

"It's about Microsoft Excel"