Go Back   TechArena Community > Software > Software Development
Become a Member!
Forgot your username/password?
Tags Active Topics RSS Search Mark Forums Read

Reply
 
Thread Tools Search this Thread
  #1  
Old 25-11-2009
Member
 
Join Date: Nov 2009
Posts: 37
How to insert random lines

Hello to all. I am looking for a way to insert 3 lines automatically whenever the column "Group" consist of the group name that is different from the previous line. Group names have letters, numbers and some special characters. I have Microsoft Office 2007 installed on my computer. Can anyone of you help me to get this?
Reply With Quote
  #2  
Old 25-11-2009
Member
 
Join Date: May 2008
Posts: 2,383
Re: How to insert random lines

You mean when you take another name for online group three interrelated or you want to scan the file (sorted by group) and each change in value of the cell group to get three lines?
__________________
The FIFA Manager 2009 PC Game
Reply With Quote
  #3  
Old 25-11-2009
Member
 
Join Date: Nov 2009
Posts: 37
Re: How to insert random lines

The file currently contains 550 lines without spaces. The group "ABC" is in column E on lines 4,5 and 6. The group "DEF" is currently on lines 7 and 8 ... . I try to make 3 lines added what is currently on line 7 and following 3 lines below. Then the same thing after the group "DEF" to be made to lines 10 and 11 following the addition of 3 lines of the first group. There are currently 82 different groups in column E. So there will be 82 X 3 lines to add.
Reply With Quote
  #4  
Old 25-11-2009
Member
 
Join Date: Nov 2008
Posts: 1,022
Re: How to insert random lines

It can be done by macro. Basically, for each row (other than the first if you start at line 1), if you look inside the line = content of the previous line and that inside the <> "" (if not at the end of your three vacuum line, you're going to put 3 others), whether you spend the next, if you insert 3 lines
Reply With Quote
  #5  
Old 25-11-2009
Member
 
Join Date: May 2008
Posts: 2,383
Re: How to insert random lines

Code:
Sub insertline ()
 Dim a,t
 t = Range ( "a65535"). End (xlUp). Row 
 For a = 2 To t
 If Cells (a, 1). Value <> Cells (a - 1, 1). Value Then 
 Range (Cells (a, 1), Cells (a + 2, 1)). EntireRow. Insert 
 t = t + 3 
 a = a + 3 
 End If
 Next
 End Sub
__________________
The FIFA Manager 2009 PC Game
Reply With Quote
Reply

  TechArena Community > Software > Software Development
Tags: , , , ,



Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads for: "How to insert random lines"
Thread Thread Starter Forum Replies Last Post
Generate some quality of random number via Random Number Generation function aMADeO! Windows Software 4 13-01-2012 05:07 PM
Why are T1 lines so expensive? Shakaal Networking & Security 4 16-09-2010 12:18 PM
Create .bat and insert lines from .vbs Micka Software Development 3 08-05-2010 07:48 PM
How to use "Math.random()" to generate a random number in JavaScript? Silent~Kid Software Development 5 03-02-2010 05:06 AM
How to use sed to insert lines in a file McGrawh Software Development 2 24-06-2009 11:45 PM


All times are GMT +5.5. The time now is 06:04 AM.