Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 4
Default Insert row(s) with vba

I'd appreciate some help to determine if I'm attempting the impossible...

We have a workbook to generate proposals. Each proposal contains numerous
sections. Each section has many line items. The first item in section 1 is
numbered 01-001, the next 01-002 etc. The 01 is the section number, the 001
is the item number. Iuse the formula:-
=CONCATENATE((TEXT($A$2,"00")),"-",(TEXT((RIGHT(OFFSET(A5,-1,0),3)+1),"000")))
to automatically generate the item number row by row. The value in $A$2 is
the section number. This way I can use vba to insert a row and the numbers
look after themselves.

If we're lucky enough to get the order I'd like to use the proposal workbook
as a basis for executing the contract. Now for the problem. Each item in the
proposal could consist of a number of separate sub items which we'd then
identify as 01-001-001, 01-001-002 etc to allow us to order all the bits.

What I'm trying to do is generate some vba to insert a row (or a number of
rows) that allows me to detail the sub items but not lose the original
numbering.

Something like this:-

Proposal
Item No. Sub-item Name
01-001 Widget A
01-002 Widget B

Now a contract - use vba to insert rows where necessary
Item No. Sub-item Name
01-001 Widget A
01-001 001 Sub part a1
01-001 002 Sub part a2
01-002 Widget B
01-002 001 Sub part b1
01-002 002 Sub part b2
01-002 003 Sub part b3

I think I've rambled enough. Any help appreciated.

Andy
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1,522
Default Insert row(s) with vba

You can make a macro starting from the bottom up

if cells(i-1,1)<cells(i,1) then rows(i).resize(2).insert


--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Andy Bailey" wrote in message
...
I'd appreciate some help to determine if I'm attempting the impossible...

We have a workbook to generate proposals. Each proposal contains numerous
sections. Each section has many line items. The first item in section 1 is
numbered 01-001, the next 01-002 etc. The 01 is the section number, the
001
is the item number. Iuse the formula:-
=CONCATENATE((TEXT($A$2,"00")),"-",(TEXT((RIGHT(OFFSET(A5,-1,0),3)+1),"000")))
to automatically generate the item number row by row. The value in $A$2 is
the section number. This way I can use vba to insert a row and the numbers
look after themselves.

If we're lucky enough to get the order I'd like to use the proposal
workbook
as a basis for executing the contract. Now for the problem. Each item in
the
proposal could consist of a number of separate sub items which we'd then
identify as 01-001-001, 01-001-002 etc to allow us to order all the bits.

What I'm trying to do is generate some vba to insert a row (or a number of
rows) that allows me to detail the sub items but not lose the original
numbering.

Something like this:-

Proposal
Item No. Sub-item Name
01-001 Widget A
01-002 Widget B

Now a contract - use vba to insert rows where necessary
Item No. Sub-item Name
01-001 Widget A
01-001 001 Sub part a1
01-001 002 Sub part a2
01-002 Widget B
01-002 001 Sub part b1
01-002 002 Sub part b2
01-002 003 Sub part b3

I think I've rambled enough. Any help appreciated.

Andy


  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 4
Default Insert row(s) with vba

Don,

Appreciate your help. I tried to implement your suggestion but didn't get
very far. I'm not sure I explained my problem too well.

What I'm after is some way to enter a new row but get the formula references
to ignore the fact that I've entered a new row and "respect" their original
references.

Thanks

Andy
  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1,522
Default Insert row(s) with vba

If desired, send your file to my address below. I will only look if:
1. You send a copy of this message on an inserted sheet
2. You give me the newsgroup and the subject line
3. You send a clear explanation of what you want
4. You send before/after examples and expected results.


--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Andy Bailey" wrote in message
...
Don,

Appreciate your help. I tried to implement your suggestion but didn't get
very far. I'm not sure I explained my problem too well.

What I'm after is some way to enter a new row but get the formula
references
to ignore the fact that I've entered a new row and "respect" their
original
references.

Thanks

Andy


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Cannot insert worksheet in exel - not available in insert menu pedro39 Excel Worksheet Functions 1 July 24th 08 12:09 PM
insert row / insert column command buttons fairgreen Excel Worksheet Functions 1 October 29th 07 02:41 PM
How can I insert a date with an icon (calendar) insert Alfredo Mederico[_2_] Excel Discussion (Misc queries) 4 September 21st 07 01:20 AM
Can I auto insert a worksheet when I insert a value in a cell. iainc Excel Worksheet Functions 0 April 27th 06 08:37 AM
Insert Next? Or insert a variable number of records...how? Tom MacKay Excel Discussion (Misc queries) 0 April 20th 06 10:44 PM


All times are GMT +1. The time now is 03:00 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"