Home |
Search |
Today's Posts |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
You need to loop in reverse (from highest to lowest) or you will screw up
your location. Dim col as Long, firstRow as long, lastRow as long Dim i as Long col = Range("myCodes").Column firstRow = Range("MyCodes").Rows(1).Row lastRow = Range("Mycodes").Rows( _ Range("MyCodes").Rows.count).Row for i = lastrow to firstrow step -1 myValue = cells(i,col).offset(0,5).Value - 1 cells(i,col).offset(1,0).Resize(myValue).EntireRow .Insert Next -- Regards, Tom Ogilvy "tina" wrote in message ... Hi I would like to insert the number of rows of variable "myvalue" i have wriiten this so far For Each Cell In Range("MYCODES") MYVALUE = Cell.Offset(0, 5).Value - 1 Cell.EntireRow.Rows(1, MYVALUE).Insert Next Cell I know insert line is incorrect but can't think what it should be Thanks Tina |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Summing a variable number of rows | Excel Discussion (Misc queries) | |||
Insert Variable Number of Rows; With Loop | Excel Worksheet Functions | |||
Insert Next? Or insert a variable number of records...how? | Excel Discussion (Misc queries) | |||
Insert rows in depending on criteria in variable columns | Excel Programming | |||
Paste to variable number of rows | Excel Programming |