LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 595
Default novice working with a spredsheet

On 9 Mar 2007 10:13:43 -0800, wrote:


Now i have got as far as using the number entered into NumberofKeys
and inserting that many blank rows below that specific row.
This is done for the entire worksheet one time, and any further new
properties are manually entered at the bottom of the sheet.
We have close to 1,000 properties on the list, so this is a one-shot
deal and once done wont need to be repeated BUT i would like to
understand the work behind the macro in case i need it again.


I've changed a few things from Tom's macro, but I've commented everything,
so hopefully you can follow it. Be sure to post back if there's something
you don't understand.

Sub InsertRows()

Dim lastRow As Long, cell As Range
Dim i As Long

'Find the last row with data in it
lastRow = Cells(Rows.Count, "d").End(xlUp).Row

'Loop (bottom to top) through the rows
For i = lastRow To 2 Step -1
'Assign a variable to the current row
Set cell = Cells(i, "d")
'Make sure the cell contains a number
If IsNumeric(cell.Value) Then
'Make sure the cell's number is greater than 1
If cell.Value 1 Then
'Insert rows below the current row
cell.Offset(1, 0).Resize(cell.Value - 1).EntireRow.Insert
'Copy the current row to the newly inserted rows
cell.Resize(cell.Value).EntireRow.FillDown
End If
End If
Next i

End Sub

--
Dick Kusleika
Microsoft MVP-Excel
http://www.dailydoseofexcel.com
 
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
Spredsheet problem wildlife guy Excel Worksheet Functions 4 December 10th 09 06:10 AM
how to delete a spredsheet in office 2007 brian Excel Discussion (Misc queries) 1 December 28th 08 09:24 AM
if I already have a Spredsheet, but I wanna add more,How? SPREADSHEETS Excel Worksheet Functions 2 May 4th 06 05:26 PM
How to transfer a sum from one spredsheet to another Therese Excel Discussion (Misc queries) 2 December 21st 05 09:17 PM
I need a work in progress spredsheet Luanne Excel Discussion (Misc queries) 2 August 19th 05 07:25 PM


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