ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Adding Row to this macro (https://www.excelbanter.com/excel-discussion-misc-queries/24785-adding-row-macro.html)

Nigel

Adding Row to this macro
 
Hi,
I have this macro which runs in a routine on a hidden sheet when a button is
pressed.

iRow = ws.Cells(Rows.Count, 1) _
.End(xlUp).Offset(1, 0).Row

Can anyone help me to carry out the following?
When it has found the next available cell on the hidden sheet, i would like
it to add a row. Help mist graciously appreciated.


nigel

Bob Phillips

iRow = ws.Cells(Rows.Count, 1) _
.End(xlUp).Offset(1, 0).Row
ws.rows(iRow).Insert

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Nigel" wrote in message
...
Hi,
I have this macro which runs in a routine on a hidden sheet when a button

is
pressed.

iRow = ws.Cells(Rows.Count, 1) _
.End(xlUp).Offset(1, 0).Row

Can anyone help me to carry out the following?
When it has found the next available cell on the hidden sheet, i would

like
it to add a row. Help mist graciously appreciated.


nigel




Don Guillett

try one of these

Sub addrow()
Set ws = Sheets(4)
ws.Rows(ws.Cells(Rows.Count, 1).End(xlUp).Row).Insert
End Sub

Sub addrow1()
With Sheets(4)
..Rows(.Cells(.Rows.Count, 1).End(xlUp).Row).Insert
End With
End Sub
--
Don Guillett
SalesAid Software

"Nigel" wrote in message
...
Hi,
I have this macro which runs in a routine on a hidden sheet when a button

is
pressed.

iRow = ws.Cells(Rows.Count, 1) _
.End(xlUp).Offset(1, 0).Row

Can anyone help me to carry out the following?
When it has found the next available cell on the hidden sheet, i would

like
it to add a row. Help mist graciously appreciated.


nigel





All times are GMT +1. The time now is 08:01 AM.

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