Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / Programming / January 2008

Tip: Looking for answers? Try searching our database.

insert rows programmatically with formula change

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Newbie - 23 Jan 2008 09:44 GMT
I have a spread sheet that is grouped where the top line of the group
determines the Qty of Item and the Total value for the item

eg 1 Table (row 1) requires 1 table top, 2 chairs and 4 legs (rows 2 to 4)
if I change the qty in Row 1 (i.e. No of Tables)  the parts automatically
change as well.

eg
               Col A        B              C                 D
E
               Qty                          Unit
                             formula       Rate                Value
Total
Row 1        1
300
Row 2        2          A2*A$1     50                      100
Row 3        1          A3*A$1    100                    100
Row 4        4          a4*A$1      25                    100

I want to be able to copy this grouping so that the formula in column B (the
A$1 part)  always refers to the relative Row 1 of the group i.e if I copy
and insert the group at Row 6 the formula in Row 6 would change to A7 * A$6
etc

Is there a way of using a command button to copy the group and then paste it
into the spreadsheet at the row that has been selected and then update the
formula in the rows with the row number of the insertion point

eg it copies the group , I then select row 13 as the insertion point, this
row number is stored in a variable, so that the formula in row 14, 15 and 16
is updated to A14*A$13, A15*A$13 and A16*A$13

I do have some knowledge of VBA but in Access not Excel so a dummies guide
would be much appreciated to any solution that may be offered

Thanks
Mike Fogleman - 23 Jan 2008 11:28 GMT
It has to do with the $ sign in the formula. You used A2*A$1 in row 2 so you
could drag down the formula to row 4, and all formulas would refer to row 1
(absolute). Now when you move this section you will want to remove the $
before you copy it. That way they will reference the new rows that it is
pasted to (relative). To quickly do that select B2:B4 and hit Ctrl+H
(replace with). Replace what: $, Replace with: (leave blank), click replace
all. Now you can copy your formulas to anywhere and their relationship
remain intact.

Mike F
>I have a spread sheet that is grouped where the top line of the group
>determines the Qty of Item and the Total value for the item
[quoted text clipped - 29 lines]
>
> Thanks
Newbie - 23 Jan 2008 11:50 GMT
Thanks for this.  This would be ok if I was doing the copying.  This is a
spreadsheet that is used by people that have no knowledge of excel and
therefore editing to formulas is not a solution unfortunately.
It needs to be 'fool' proof

Thanks again
> It has to do with the $ sign in the formula. You used A2*A$1 in row 2 so
> you could drag down the formula to row 4, and all formulas would refer to
[quoted text clipped - 40 lines]
>>
>> Thanks
Mike Fogleman - 23 Jan 2008 22:17 GMT
Then remove the $ signs from the formulas yourself, before you give it to
them. The $ was for your convenience when you drag down the formulas. Once
the formulas are in place the $ signs are no longer needed.

Mike F
> Thanks for this.  This would be ok if I was doing the copying.  This is a
> spreadsheet that is used by people that have no knowledge of excel and
[quoted text clipped - 47 lines]
>>>
>>> Thanks
Newbie - 24 Jan 2008 16:10 GMT
That is ok when copying the whole group however if they want to insert a row
within the group the formula needs to have the $ sign so that it refers to
the group header.

> Then remove the $ signs from the formulas yourself, before you give it to
> them. The $ was for your convenience when you drag down the formulas. Once
[quoted text clipped - 52 lines]
>>>>
>>>> Thanks
Mike Fogleman - 25 Jan 2008 12:09 GMT
Is inserting rows in the middle of a group something the user would normally
be doing?

Mike F
> That is ok when copying the whole group however if they want to insert a
> row within the group the formula needs to have the $ sign so that it
[quoted text clipped - 56 lines]
>>>>>
>>>>> Thanks
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.