copying and pasting not adjecent cells

N

nick

I have an excel sheet that performs a calculation on a huge amount of
data. The solutions eventually end up in not adjecent cells (like A23,
D12, F56...) Now I would like to make a database in another sheet, but
if I just paste the data it ends up all over the sheet. Is there a way
to paste the data to adjecent cells?
Array's perhaps? Can anybody help?
 
C

Chrissy

How do you know what cells you want to copy? Is it always
A23, D12 etc?

If it is and these cells form a grid then you can name them and
copy the named range and paste to the single area you want.
If the cells you want to copy are not able to be made into a
regular shaped are (a rectangle) then you cannot copy them
as one area. If you do not follow that then think of it like this:
Can you select all the cells you want as a single area by hiding
whole rows and whole columns? If you can then your area
can be copied as a single area.

Another way would be to have an extra sheet which has, in the
shape you want the results, formulas which point to the cells
you want them to show then copy this area and paste it to the
new area. That way the copied area is the shape you want.

Chrissy.
 
T

Tom Ogilvy

rw = 2
icol = 1
for each cell in Range("A23,D1,F56")
cell.copy Destination = worksheets("Sheet2").Cells(rw,icol)
icol = icol + 1
Next

as an example
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top