Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Within a macro I have a "found" cell (Find "US03" in certain column) which
can be on any row. I need code to count down 170 rows from this cell and insert 2 rows. This is done from the top of the worksheet. Thanks!! Valerie |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
not sure where you want to start, but this may give you an idea on how to do
what you want Worksheets("Sheet1").Range("A1").Offset(170).Resiz e(2).EntireRow.Insert -- Gary "Valerie" wrote in message ... Within a macro I have a "found" cell (Find "US03" in certain column) which can be on any row. I need code to count down 170 rows from this cell and insert 2 rows. This is done from the top of the worksheet. Thanks!! Valerie |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi,
try something like DIm rg as range ''' where to search set rg=activesheet.range("U:U") ''' search for 'found' set rg=rg.find(what:="found", lookin:=xlvalues, lookat:=xlwhole) ''' process result if rg is nothing then ''' was not fond msgbox "Not found" else ''' go 170 rows bellow that found cell set rg=rg.offset(170) ''' resize to 2 rows set rg= rg.resize(2) ''' insert 2 rows rg.EntireRow.Insert xlShiftDown end if -- Regards, Sébastien <http://www.ondemandanalysis.com "Valerie" wrote: Within a macro I have a "found" cell (Find "US03" in certain column) which can be on any row. I need code to count down 170 rows from this cell and insert 2 rows. This is done from the top of the worksheet. Thanks!! Valerie |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Works like a charm!! Thanks!!
"sebastienm" wrote: Hi, try something like DIm rg as range ''' where to search set rg=activesheet.range("U:U") ''' search for 'found' set rg=rg.find(what:="found", lookin:=xlvalues, lookat:=xlwhole) ''' process result if rg is nothing then ''' was not fond msgbox "Not found" else ''' go 170 rows bellow that found cell set rg=rg.offset(170) ''' resize to 2 rows set rg= rg.resize(2) ''' insert 2 rows rg.EntireRow.Insert xlShiftDown end if -- Regards, Sébastien <http://www.ondemandanalysis.com "Valerie" wrote: Within a macro I have a "found" cell (Find "US03" in certain column) which can be on any row. I need code to count down 170 rows from this cell and insert 2 rows. This is done from the top of the worksheet. Thanks!! Valerie |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
how do i count and insert rows | Excel Discussion (Misc queries) | |||
Insert rows based on specific value | Excel Worksheet Functions | |||
Count rows and insert number to count them. | Excel Discussion (Misc queries) | |||
Count rows with specific attributes in VBA | Excel Worksheet Functions | |||
Count rows with specific date | Excel Discussion (Misc queries) |