Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 410
Default Inserting Rows in multiple areas

Column "A" is where the the data needs to be inserted. There are 3
groups of data on top of each other. For instance item #s are rows
1-3. Other information is 4-6. Misc info is 7-9. If the item
numbers were "A", "C" and "D" and I wanted to add item "B". Keeping
in mind that Row 1 relates to 4 and 6 plus I need an additional space
in each section. So in this case 2 woudl move down and become 3 to
place "B". Since 4 became 5, 5 woudl move down to become 6 and so
on. I hope I am making myself clear.

Thanks,
Jay
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 410
Default Inserting Rows in multiple areas

On Jan 24, 10:31*am, jlclyde wrote:
Column "A" is where the the data needs to be inserted. *There are 3
groups of data on top of each other. *For instance item #s are rows
1-3. *Other information is 4-6. *Misc info is 7-9. *If the item
numbers were "A", "C" and "D" and I wanted to add item "B". * Keeping
in mind that Row 1 relates to 4 and 6 plus I need an additional space
in each section. *So in this case 2 woudl move down and become 3 to
place "B". *Since 4 became 5, 5 woudl move down to become 6 and so
on. *I hope I am making myself clear.

Thanks,
Jay


In case anyone was interested, I have figured it out on my own. Here
is the code.

Sub InsertChristmasCard()
Dim x As Variant, set1 As Long, s As String
Dim Srow As Integer
s = InputBox("Enter new Christmas Number")
If s = "" Then Exit Sub
Application.ScreenUpdating = False
set1 = Cells(Range("F2").Value - 1, 1).Row
x = Application.Match(s, Range("A4:A" & set1), 1) 'assumes names
in order starting in row 2
If IsError(x) Then 'new name will be first
set1 = 4
Else
set1 = x + 4
End If
Rows(set1).Insert
Cells(set1, 1) = s

Srow = Cells.Find(s).Row
Rows(Srow - Range("F1").Value + Range("F2").Value).Insert
Rows(Srow - Range("F1").Value + Range("F3").Value).Insert
Application.ScreenUpdating = True
End Sub

F2 =ROW("The first cell in teh 2nd group") F3 =ROW("The first cell in
the 3rd group")
Jay
Reply
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 Multiple rows Larry in Seattle Excel Discussion (Misc queries) 2 August 28th 07 08:48 PM
Inserting multiple rows every other row Scottm Excel Discussion (Misc queries) 1 February 14th 07 08:19 PM
Inserting multiple non-consecutive rows piper1963 Excel Discussion (Misc queries) 3 June 22nd 06 12:02 AM
Inserting Multiple Rows Mike Excel Discussion (Misc queries) 4 February 9th 06 01:21 AM
Inserting multiple rows syssupspe Excel Discussion (Misc queries) 3 January 13th 06 05:06 PM


All times are GMT +1. The time now is 03:25 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"