Public Schedule Face-to-Face & Online Instructor-Led Training - View dates & book

vba insert rows

ResolvedVersion 2003

Tim has attended:
Excel Intermediate course
Outlook Advanced course
Excel VBA Intro Intermediate course
Excel Advanced course
PowerPoint Introduction course
PowerPoint Intermediate Advanced course
Excel Advanced course
Excel Advanced - For Power Users course

VBA insert rows

Could you help me with the code requirdd insert rows on multiple worksheets

RE: VBA insert rows

Hi Steve

Thanks for your question.

Can you just clarify for me the following points.

1. Do you need to insert single or multiple rows?
2. If the later, are they grouped together, or spread over the entire sheet

Thanks

Stephen

RE: VBA insert rows

Hi Stephen,

I have created some management accounts with a worksheet for each cost centre. If then we want to create a new line in the accounts, a new type of travel cost etc., I want to be able to insert a new line in each cost centres accounts and add into the line the name of the new cost and a formula.

Hope that is clearer.

Cheers

Tim

RE: VBA insert rows

Hi Tim

Thanks for the update.

I suggest the following approach

1. Use a "For each" loop to go to each worksheet in the workbook.
2. Within the loop (for each sheet), insert a new row in the appropriate place. The following is a sample of code for this.

Range("A2").Rows.Insert shift:=xlDown


3. set the new cost and formula as the values of the relevant cell.

Hope this helps

Regards

Stephen

 

Training courses

Training information:

Welcome. Please choose your application (eg. Excel) and then post your question.

Our Microsoft Qualified trainers will then respond within 24 hours (working days).

Frequently Asked Questions
What does 'Resolved' mean?

Any suggestions, questions or comments? Please post in the Improve the forum thread.

Excel tip:

Reconciling a list to correspond with another

May have a list that needs to make but on another sheet one list seems to be out, eg. product list one sheet contains all product and inventory data, while the other contains pricing data. Both need to match with all products but there is more products in one list than the other. To find the disparaging product compare data in the two columns that need to match Make sure that order the same way.
Create another column in the sheet that has the most items and type in the first cell


=Exact(text1,text2) text1 being the cell that you want compared with text2 cell reference. Drag to filldown and your first false will give you for first cells that does not match. Correct insert the row with data in other sheet and continue the process until all the data returns true. Delete the column inserted.

View all Excel hints and tips

Connect with us:

0207 987 3777

Call for assistance

Request Callback

We will call you back

Server loaded in 0.1 secs.