View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips[_6_] Bob Phillips[_6_] is offline
external usenet poster
 
Posts: 11,272
Default Inserting rows based on count

Hi Mike,

numrows = Combox1.Value - WorksheetFunction.CountIf(Columns("I:I"), 1)
Cells(Rows.Count, "I").End(xlUp).Offset(1, 0).Resize(numrows,
1).EntireRow.Insert

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Mike" wrote in message
...
I need a macro that can count how many rows have a certain
value(lets say "1") in column "I" and then inset rows
based on the selected value(lets say "12") of a combobox
minus the count of rows.

Example: 5 rows have a value of 1 in column "I" and 12 is
the value of the combobox = 7 rows to be inserted after
the last row that has the value 1 in column "I".

If 24 is the selected combobox value, 19 rows have to be
inserted after the last row that has the value 1 in
column "I".

This is a bit beyond my knowledge so any help is
appreciated.

Mike