ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Insert row (https://www.excelbanter.com/excel-programming/294388-insert-row.html)

gav meredith

Insert row
 
Hi,

Based upon some type of selection method (check box, value 1, etc) how
would i get excel to insert 2 rows?? ie: cell A1 on sheet1 1, then insert
2 rows on sheet2 after a30.....any suggestions would be great!!!!



Rob van Gelder[_4_]

Insert row
 
Sub test()
If Worksheets("Sheet1").Range("A1").Value 1 Then
Worksheets("Sheet2").Range("31:32").Insert xlShiftDown
End If
End Sub


--
Rob van Gelder - http://www.vangelder.co.nz/excel


"gav meredith" wrote in message
...
Hi,

Based upon some type of selection method (check box, value 1, etc) how
would i get excel to insert 2 rows?? ie: cell A1 on sheet1 1, then

insert
2 rows on sheet2 after a30.....any suggestions would be great!!!!





gav meredith

Insert row
 
Thanks Rob! Is this all i need or is there another part of the code??

"Rob van Gelder" wrote in message
...
Sub test()
If Worksheets("Sheet1").Range("A1").Value 1 Then
Worksheets("Sheet2").Range("31:32").Insert xlShiftDown
End If
End Sub


--
Rob van Gelder - http://www.vangelder.co.nz/excel


"gav meredith" wrote in message
...
Hi,

Based upon some type of selection method (check box, value 1, etc) how
would i get excel to insert 2 rows?? ie: cell A1 on sheet1 1, then

insert
2 rows on sheet2 after a30.....any suggestions would be great!!!!







Rob van Gelder[_4_]

Insert row
 
Your request was an example for:

"cell A1 on sheet1 1, then insert 2 rows on sheet2 after a30"

That's what the code I supplied does.

--
Rob van Gelder - http://www.vangelder.co.nz/excel


"gav meredith" wrote in message
...
Thanks Rob! Is this all i need or is there another part of the code??

"Rob van Gelder" wrote in message
...
Sub test()
If Worksheets("Sheet1").Range("A1").Value 1 Then
Worksheets("Sheet2").Range("31:32").Insert xlShiftDown
End If
End Sub


--
Rob van Gelder - http://www.vangelder.co.nz/excel


"gav meredith" wrote in message
...
Hi,

Based upon some type of selection method (check box, value 1, etc)

how
would i get excel to insert 2 rows?? ie: cell A1 on sheet1 1, then

insert
2 rows on sheet2 after a30.....any suggestions would be great!!!!









gav meredith

Insert row
 
i understand but i am a novice to VB. Do i simply need to insert this or
create a click event??
"Rob van Gelder" wrote in message
...
Your request was an example for:
.
"cell A1 on sheet1 1, then insert 2 rows on sheet2 after a30"

That's what the code I supplied does.

--
Rob van Gelder - http://www.vangelder.co.nz/excel


"gav meredith" wrote in message
...
Thanks Rob! Is this all i need or is there another part of the code??

"Rob van Gelder" wrote in

message
...
Sub test()
If Worksheets("Sheet1").Range("A1").Value 1 Then
Worksheets("Sheet2").Range("31:32").Insert xlShiftDown
End If
End Sub


--
Rob van Gelder - http://www.vangelder.co.nz/excel


"gav meredith" wrote in message
...
Hi,

Based upon some type of selection method (check box, value 1, etc)

how
would i get excel to insert 2 rows?? ie: cell A1 on sheet1 1, then
insert
2 rows on sheet2 after a30.....any suggestions would be great!!!!











Rob van Gelder[_4_]

Insert row
 
Code is triggered to run. How that's triggered depends on what you need it
for.

For example, if you wanted that code to run whenever a button is clicked:
From Visual Basic: Insert Module - insert the code into the module
From Excel: Ensure the Form toolbar is visible (View | Toolbars | Forms)
Drop a Button onto your worksheet (an 'assign macro' window appears)
Assign the macro


--
Rob van Gelder - http://www.vangelder.co.nz/excel


"gav meredith" wrote in message
...
i understand but i am a novice to VB. Do i simply need to insert this or
create a click event??
"Rob van Gelder" wrote in message
...
Your request was an example for:
.
"cell A1 on sheet1 1, then insert 2 rows on sheet2 after a30"

That's what the code I supplied does.

--
Rob van Gelder - http://www.vangelder.co.nz/excel


"gav meredith" wrote in message
...
Thanks Rob! Is this all i need or is there another part of the code??

"Rob van Gelder" wrote in

message
...
Sub test()
If Worksheets("Sheet1").Range("A1").Value 1 Then
Worksheets("Sheet2").Range("31:32").Insert xlShiftDown
End If
End Sub


--
Rob van Gelder - http://www.vangelder.co.nz/excel


"gav meredith" wrote in message
...
Hi,

Based upon some type of selection method (check box, value 1,

etc)
how
would i get excel to insert 2 rows?? ie: cell A1 on sheet1 1,

then
insert
2 rows on sheet2 after a30.....any suggestions would be great!!!!
















All times are GMT +1. The time now is 02:36 PM.

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