Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
ian123
 
Posts: n/a
Default help to copy and paste with VB

I need help to do the following
i need to copy and paste adresses from on sheet to another depending on the
cell value
EXAMPLE:

IF cell a2 on sheet 1 says "1" then copy the address (cells a1 to a5 on sheet
1) to cells d1 to d5 on sheet 2

if cell A2 on sheet 1 says "54" then copy THAT address (cells a1 to a5 on
sheet 1) to cells d10 to d15 on sheet 2
ANYONES HELP WOULD BE VERY APPRECIATED thanks
  #2   Report Post  
Posted to microsoft.public.excel.misc
Chip Pearson
 
Posts: n/a
Default help to copy and paste with VB

I'm not entirely clear what you want to do, but you might try
some code like

Select Case Worksheets("Sheet2").Range("A2").Value
Case 1
Range("A1:A5").Copy
Destination:=Worksheets("Sheet2").Range("D1")
Case 54
Range("A1:A5").Copy
Destination:=Worksheets("Sheet2").Range("D10")
End Select



--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com



"ian123" wrote in message
...
I need help to do the following
i need to copy and paste adresses from on sheet to another
depending on the
cell value
EXAMPLE:

IF cell a2 on sheet 1 says "1" then copy the address (cells a1
to a5 on sheet
1) to cells d1 to d5 on sheet 2

if cell A2 on sheet 1 says "54" then copy THAT address (cells
a1 to a5 on
sheet 1) to cells d10 to d15 on sheet 2
ANYONES HELP WOULD BE VERY APPRECIATED thanks



  #3   Report Post  
Posted to microsoft.public.excel.misc
Chip Pearson
 
Posts: n/a
Default help to copy and paste with VB

The code got line-wrapped in the post. The Destination argument
should be on the same line as Copy.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com

"Chip Pearson" wrote in message
...
I'm not entirely clear what you want to do, but you might try
some code like

Select Case Worksheets("Sheet2").Range("A2").Value
Case 1
Range("A1:A5").Copy
Destination:=Worksheets("Sheet2").Range("D1")
Case 54
Range("A1:A5").Copy
Destination:=Worksheets("Sheet2").Range("D10")
End Select



--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com



"ian123" wrote in message
...
I need help to do the following
i need to copy and paste adresses from on sheet to another
depending on the
cell value
EXAMPLE:

IF cell a2 on sheet 1 says "1" then copy the address (cells a1
to a5 on sheet
1) to cells d1 to d5 on sheet 2

if cell A2 on sheet 1 says "54" then copy THAT address (cells
a1 to a5 on
sheet 1) to cells d10 to d15 on sheet 2
ANYONES HELP WOULD BE VERY APPRECIATED thanks





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
Can't Copy and Paste or Paste Special between Excel Workbooks wllee Excel Discussion (Misc queries) 5 April 29th 23 03:43 AM
Copy / Paste Warning wbmcse Excel Discussion (Misc queries) 0 March 3rd 06 07:04 PM
Macro to find, copy, and paste until value change Valerie Excel Worksheet Functions 4 January 26th 06 04:10 AM
Macro to open workbook and copy and paste values in to orig workbo Dena X Excel Worksheet Functions 1 December 15th 05 11:13 PM
Can't Copy and Paste between Excel 2003 Workbooks wllee Excel Discussion (Misc queries) 6 March 30th 05 02:59 PM


All times are GMT +1. The time now is 02:26 AM.

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"