LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Insert rows

Sorry for posting, found the answer
rows(value1 & ":" & value2).insert shift:=xlDown

"Karti" wrote in message
...
Hi,
I am using the following VBA code to insert a number of rows starting
from the value contained in cells(5,3) and ends before or on cells(10,3)
the values are always in ascending order and in series. like 12, 13,1 4
etc. I am getting a type mismatch error in the last line of code. It will
be great if someone can help me out with this.

Sub main()
Dim i As Integer
Dim value1 As Integer
Dim value2 As Integer
value1 = Cells(5, 3).Value
For i = 1 To 5
If Cells(5 + i, 3) < "" Then
value2 = Cells(5 + i, 3).Value
'MsgBox value2
End If
Next i
'MsgBox value2
Rows("value1:value2").Insert shift:=xlDown


End Sub




 
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
insert rows and copying cells in column b,c, and d into new rows gbpg Excel Programming 0 December 31st 09 12:34 AM
VBA to count rows from specific cell and insert rows Valerie Excel Programming 3 November 26th 07 10:14 PM
Insert rows: Formats & formulas extended to additonal rows Twishlist Excel Worksheet Functions 0 October 22nd 07 04:23 AM
Insert page breaks every 50 rows but do not include hidden rows Martin[_21_] Excel Programming 5 March 12th 07 05:10 PM
Copy Rows and insert these rows before a page break AQ Mahomed Excel Programming 0 June 8th 04 09:09 AM


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