Home |
Search |
Today's Posts |
#7
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
or two<vbg
-- HTH Bob Phillips ... looking out across Poole Harbour to the Purbecks (remove nothere from the email address if mailing direct) "chris" wrote in message ... Yet another version: Public Sub AddRws(Val as string, ColumnNum as integer) Dim x, LstVal, y As Integer, Cnt As Integer, CbxVal As Integer, FrstVal As String CbxVal = CInt(Cbx.Value) Range("A1").EntireRow.Insert With ActiveSheet.Columns(ColumnNum) .Cells(1).Select Set x = .Find(What:=Val, After:=ActiveCell, LookIn:=xlValues, LookAt:= _ xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=True) If Not x Is Nothing Then Cnt = Cnt + 1 FrstVal = x.Address Do Set LstVal = x Set x = .FindNext(x) Cnt = Cnt + 1 Loop While Not x Is Nothing And x.Address < FrstVal Cnt = Cnt - 1 If Cnt < CbxVal Then Range(LstVal.Address).Offset(1, 0).Select For y = 1 To CbxVal - Cnt ActiveCell.EntireRow.Insert Next End If End If End With Range("A1").EntireRow.Delete End Sub |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Count rows based on multiple criteria | Excel Worksheet Functions | |||
need help please inserting multiple rows based on cell value then copying to data sheet | Excel Worksheet Functions | |||
Return Frequently occuring Rows, based on COUNT | Excel Worksheet Functions | |||
Count rows based on multiple criteria | Excel Worksheet Functions | |||
Inserting rows based on another cells value | Excel Programming |