![]() |
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 |
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 |
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 |
All times are GMT +1. The time now is 04:27 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com