View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
ToferKing ToferKing is offline
external usenet poster
 
Posts: 41
Default Copy/Paste Macro

O.K., my guru friends, here is the problem I am having now.

I have a list of 70 pieces of equipment (how many times have you read that
from me?) And I need to perform a copy from that list which right now is
located in cells CN591:CN662. This range reference will change as rows are
inserted and deleted in the rest of the workbook. (I am unable to place the
list on Sheet2, because I have some conditional formatting that I use on
Sheet 1 and it references this block of cells, so this list must remain on
Sheet 1.)

I have taken this list of equipment and placed it at the top of my sheet in
six columns - H, L, P, T, X and AA and thirteen rows (5 through 17.) But to
get the equipment descriptions in that upper portion of the workbook, I have
used a formula in each of those cells.

H5 =CN591
H6 =CN592
H7 =CN593
etc.
H17 =CN603

Then I run out of room in that column, so in column L I continue the list

L5 =CN604
L6 =CN605
L7 =CN606
Etc.
L17 =CN616

Then I run out of room in that column, so in column P I continue the list

P5 =CN617
P6 =CN618
P7 =CN619
Etc.
P17 =CN629

Then I run out of room in that column, so in column T I continue the list.

Surely you get the picture by now.

My problem comes in when I insert a new piece of equipment or delete a piece
of equipment out of my source range CN591:CN662. I actually delete the row
the equipment was listed on or a insert a new row for the new piece of
equipment.

The ramifications are that the list at the top of the page in columns H, L,
P, T, X and AA either don't show a piece of equipment that I added or give me
a #REF error.

Do you have a solution through a macro to rebuild the formulas up there in
H, L, P, T, X and AA so that when a piece of equipment is added or deleted,
those formulas will rebuild themselves?

I can name the first cell in the range EquipmentTop if that helps my case.

Then can I build the formulas in the H, L, P, T, X and AA in R1C0 format?

H5 =EquipmentTop
H6 =r1c1(EquipmentTop+r1) - something like that?

If I do the formulas that way, will I get an error or a skip if I add or
delete rows?

Tofer