Paste one array does not take desired Format

drom

Well-known Member
Joined
Mar 20, 2005
Messages
543
Office Version
  1. 2021
  2. 2019
  3. 2016
  4. 2013
  5. 2011
  6. 2010
  7. 2007
Hi and thanks in advance!

I have one array with with many rows and Columns, populated using a Macro

when I have to paste this array in a sheet.

I get the Values OK, but the formatting of the pasted cells do not show the values the way I was expecting.

I mean: say
Code:
Sheets(1).Cells(5, 1).Resize(xRows, xCols) = aData
xRows is equal to UBound(aData, 1)
xCols is equal to UBound(aData, 2)

but if aData(2,5) is equal to 106201700000036, because this value comes from a sheet("XX").range("C25000") and this cell shows the full value and is formatted as Text
Sheets(1).Cells(3, 6) shows 1,06202E+14, despite this Column is formatted as well as Text

is there any way of avoiding this ?

ps: the Pasted Place is formatted the same way the origin cells,
so when I need Text comes and goes to columns formatted as Text
When I need Value comes and goes from Columns formatted as values

Thanks!
 

Excel Facts

Using Function Arguments with nested formulas
If writing INDEX in Func. Arguments, type MATCH(. Use the mouse to click inside MATCH in the formula bar. Dialog switches to MATCH.
Hi and thanks in advance!

I have one array with with many rows and Columns, populated using a Macro

when I have to paste this array in a sheet.

I get the Values OK, but the formatting of the pasted cells do not show the values the way I was expecting.

I mean: say
Rich (BB code):
Sheets(1).Cells(5, 1).Resize(xRows, xCols) = aData
xRows is equal to UBound(aData, 1)
xCols is equal to UBound(aData, 2)

but if aData(2,5) is equal to 106201700000036, because this value comes from a sheet("XX").range("C25000") and this cell shows the full value and is formatted as Text
Sheets(1).Cells(3, 6) shows 1,06202E+14, despite this Column is formatted as well as Text

is there any way of avoiding this ?

ps: the Pasted Place is formatted the same way the origin cells,
so when I need Text comes and goes to columns formatted as Text
When I need Value comes and goes from Columns formatted as values
Try it this way...

Sheet("XX").Range("C25000").Copy Sheets(1).Cells(5, 1)
 
Last edited:
Upvote 0
not Possible.
The array is populated from hundreds of sheets, with dinamic ranges, tables etc...
This is why i need to know if there is any way, other than using at the end of the Macro text to columns etc...
The Pasted Range could have 21000 rows
 
Upvote 0

Forum statistics

Threads
1,223,908
Messages
6,175,305
Members
452,633
Latest member
DougMo

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top