Big prodject! How to insert row or rows beneath certain text

V

vane0326

Is there a code that when a certain text is in collumn (A3) ALL CORE i
insert one row beneath it, Also if there is one or more text next t
each other, Like Collumn (A9 and A10) HUNTER-#2 and HUNTER-#2 an
there're the exactly the same then insert two rows beneath the las
Hunter-#2. But the thing is I only want it to happen to specifics text
and can it have exceptions like at A5 and A6 the text reads COPE & DRA
#2 and under it says COPE & DRAG #3 can the code it insert two row
beneath COPE & Drag #3 but if COPE & DRAGE #3 does not appear the
insert one row beneath COPE & DRAG #2 or say COPE & DRAG #2 does no
appear only COPE & DRAG #3 does then insert one row. I also have othe
workbooks that has different criterias, I know very little about visua
basic but can it be easy enough so could modify it by changing of th
text names and the number of rows that I want?
The reasons why only ceartain texts appears because I input data in
system calls AS/400 then I transfer data from the AS/400 to exce
workbook.

I tried to modified this code that I pick up on forum but it reall
does'nt do the job I'm asking for.

Thanks! :eek:

Dim cel As Range, rng As Range, t As String, sumc As Integer
Set rng = Range("A2", Range("A65536").End(xlUp))
t = "COPE & DRAG #3"
For Each cel In rng
cel.Offset(, 1).Formula = "=FIND(""" & t & """," & cel.Address & ",1)

If IsError(cel.Offset(, 1).Value) = True Then
cel.Offset(, 1).clear
Else
cel.Offset(, 1).clear
cel.Offset(, 1).Formula = "=SUM(" & cel.Offset(, 1).Address & ":" &
cel.Offset(, 1).End(xlUp).Offset(1).Address & ")"
cel.Offset(1).EntireRow.Insert Shift:=xlDown
If cel.Offset(, 1).HasFormula = True Then
End If
End If
Next cel

Thanks
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top