LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 184
Default Code to Insert rows and copy formulas

Hi all. I am trying to insert a row into multiple sheets, and copy
the formula from the row above into the newly inserted row. The row
of formulas I am copying are different on each sheet, but the row I am
inserting is the same row number on each sheet. When I do this
manually (not through code - essentially highlighting the tabs within
the workbook, and inserting a single row on the Data sheet, then
copying the formulas) it works perfectly. But when I run the code, it
only inserts a row and copies the above formulas in the Data sheet,
NOT the array of sheets. Any ideas how I can edit the below code?
Thanks so much!!

-Steve


Sub New_Project()

Dim ws As Worksheet
Dim x As Integer

x = InputBox("How many rows do you want to insert?")

Application.ScreenUpdating = False

For Each ws In Worksheets
ws.Visible = xlSheetVisible
Next

Range("B5000").End(xlUp).Select

Sheets(Array("Data", "Data2", "Data3", "Calc", "Summary", "PandL", _
"COGS Calc", "Rev Calc", "Revenue", "Transactions")).Select
Sheets("Data").Activate

ActiveCell.Offset(1, 0).Resize(x, 1).EntireRow.Insert
ActiveCell.Offset(-2 - x, 0).Select
ActiveCell.EntireRow.Copy
ActiveCell.Offset(1, 0).Resize(x, 1).EntireRow.PasteSpecial
Paste:=xlFormulas
Application.CutCopyMode = False
Selection.End(xlToLeft).Select

Sheets("Data").Select

Application.ScreenUpdating = True

End Sub

 
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
Insert row and copy formulas Hugh Excel Discussion (Misc queries) 5 September 25th 09 05:28 PM
Insert rows: Formats & formulas extended to additonal rows Twishlist Excel Worksheet Functions 0 October 22nd 07 04:23 AM
Macro to insert copy and insert formulas only to next blank row bob Excel Programming 0 June 30th 06 12:02 PM
Copy/Insert rows with formulas GregR Excel Worksheet Functions 4 April 26th 05 10:29 PM
Insert Row and copy formulas Alan Excel Programming 4 February 22nd 04 06:26 PM


All times are GMT +1. The time now is 12:18 AM.

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"