LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
Lee Lee is offline
external usenet poster
 
Posts: 33
Default Inserting a row

I found this code in a thread posted on 2/18, and modified
it slighty, as follows:

Sub test()
Dim Rng As Range
FindString = "1"
Set Rng = Range("a:a").Find(What:=FindString,
LookAt:=xlPart)
While Not (Rng Is Nothing)
Rng.EntireRow.Insert
Set Rng = Range("a" & Rng.Row + 1 & ":a" &
Rows.Count) _
.Find(What:=FindString, LookAt:=xlPart)
Wend
End Sub

First, thanks to the person who posted it. It's coming
closer than any other code I've tried to doing what I
need. However, I do have a question about it. I noticed
that it always seems to insert a row after two lines, even
when there is no 1 in column A. Basicially, I am trying
to group rows together that share a common employee ID
number. A 1 was inserted whenever a new employee ID
appears. The majority of the lines I am trying to
separate do come in pairs, but some contain three lines,
and the code is not going down three lines to insert a
row. Is there a way to make it do this? Thanks-
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Inserting a Row Curtd Excel Worksheet Functions 4 July 1st 07 07:38 PM
inserting zero dfg Excel Discussion (Misc queries) 3 May 22nd 06 12:37 PM
inserting zero dfg Excel Worksheet Functions 1 May 22nd 06 12:28 PM
inserting a row.. angelb88 Excel Discussion (Misc queries) 1 April 5th 05 05:40 PM
inserting a row erin m Excel Discussion (Misc queries) 1 January 13th 05 05:51 PM


All times are GMT +1. The time now is 04:45 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"