ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Automatically add new row (https://www.excelbanter.com/excel-programming/299500-re-automatically-add-new-row.html)

vwhungsuriya

Automatically add new row
 
Hi Bob,

Thank you for your reply.

It's too bad that it can't be done. Still it may be interesting wit
the button. Can you give me more details on that? It has to insert row
relative to the rows added in the main sheet.

The other sheets are linked to the main sheet. When the row is adde
can one do it in such a way that the links are also in there?

/Jom

Bob Phillips wrote:
*Inserting a row is not a trappable event, so you cannot do i
automatically.

You could have a button that you click that runs a macro to insert
row on
all sheets.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"vwhungsuriya " wrot
in
message ...
Hi All,

I am working with a couple of sheets in a workbook. In the mai

sheet I
add information and often I add new rows. The other sheets ar

linked
to this main sheet. I know there must be a way such that a new ro

is
added in the other sheets when I add a row in the main sheet. Even
better if it would be possible to have formulas and link

automatically
copied in as well.
I am sort of a beginner and I am wondering if you might have any
suggestions.

Thanks!


---
Message posted from http://www.ExcelForum.com/


--
Message posted from http://www.ExcelForum.com


Bob Phillips[_6_]

Automatically add new row
 
Hi Jom,

here is an example macro

Sub AddRows()
Dim numRows
Dim nRow As Long
Dim sh As Worksheet

nRow = ActiveCell.Row
numRows = InputBox("How many rows to add?")
If numRows < "" Then
For Each sh In Worksheets(Array("Sheet1", "Sheet2", "Sheet3"))
sh.Cells(nRow, "A").Resize(numRows, 1).EntireRow.Insert
Next sh
End If

End Sub


--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"vwhungsuriya " wrote in
message ...
Hi Bob,

Thank you for your reply.

It's too bad that it can't be done. Still it may be interesting with
the button. Can you give me more details on that? It has to insert rows
relative to the rows added in the main sheet.

The other sheets are linked to the main sheet. When the row is added
can one do it in such a way that the links are also in there?

/Jom

Bob Phillips wrote:
*Inserting a row is not a trappable event, so you cannot do it
automatically.

You could have a button that you click that runs a macro to insert a
row on
all sheets.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"vwhungsuriya " wrote
in
message ...
Hi All,

I am working with a couple of sheets in a workbook. In the main

sheet I
add information and often I add new rows. The other sheets are

linked
to this main sheet. I know there must be a way such that a new row

is
added in the other sheets when I add a row in the main sheet. Even
better if it would be possible to have formulas and links

automatically
copied in as well.
I am sort of a beginner and I am wondering if you might have any
suggestions.

Thanks!


---
Message posted from http://www.ExcelForum.com/
*



---
Message posted from http://www.ExcelForum.com/





All times are GMT +1. The time now is 12:38 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com