ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   How to copy formatting when moving from cell to variable to another cell on another worksheet (https://www.excelbanter.com/excel-programming/309647-how-copy-formatting-when-moving-cell-variable-another-cell-another-worksheet.html)

kls[_2_]

How to copy formatting when moving from cell to variable to another cell on another worksheet
 
I am taking data from 15 different cells on one workbook and want to
move it to another workbook where the data from the cells is arranged in
a different order, so I can't "copy and pastespecial
paste:=ValuesAndNumbersFormat" in one move. I've taken the values from
cells in the first wrkbook & set them to individual variables, activated
the second wrkbook & progressed from variables to cells.

Is there a better way, when the data is not entered in the same cells in
both workbooks, not even relatively?



*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Tom Ogilvy

How to copy formatting when moving from cell to variable to another cell on another worksheet
 
Dim rng as Range, i as Long, cell as range
rng = worksheets("Sheet2").Range("A1")
i = 0
for each cell in worksheets("sheet1") _
.Range("A1,B9,C13,D12,M21,A2,C5")
i = i + 1
cell.Copy
rng(i).Pastespecial xlValues
rng(i).PasteSpecial xlFormats
Next

--
Regards,
Tom Ogilvy


"kls" wrote in message
...
I am taking data from 15 different cells on one workbook and want to
move it to another workbook where the data from the cells is arranged in
a different order, so I can't "copy and pastespecial
paste:=ValuesAndNumbersFormat" in one move. I've taken the values from
cells in the first wrkbook & set them to individual variables, activated
the second wrkbook & progressed from variables to cells.

Is there a better way, when the data is not entered in the same cells in
both workbooks, not even relatively?



*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!





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

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com