|
-
Jul 31st, 2003, 10:58 AM
#1
Thread Starter
Junior Member
Insert as many rows as it says in cell c18
I have a macro currently that inserts rows based on values. I want to be able to have it look at cell c18 then insert that many rows starting at the first blank that it finds.
so, if it finds the first blank at h27 on the "DATA" spreadsheet, and c18 says 4, I want it to insert 4 rows starting at H27...
it will always be referencing the data sheet, it is not workbook wide. I assume this is possible... and probably not difficult, but i do not know much about visual basic.
Last edited by taosd; Aug 1st, 2003 at 08:35 AM.
-
Aug 1st, 2003, 03:06 PM
#2
Hyperactive Member
Code:
Dim yRow As Integer
Dim intInserts As Integer
yRow = 1
intInserts = CInt(Application.Range("C18"))
Do Until Len(Trim(Application.Cells(yRow, 1))) = 0
yRow = yRow + 1
Loop
For i = 1 To intInserts
Rows(yRow & ":" & yRow).Select
Selection.Insert Shift:=xlDown
Next
I don't know if this is exactly what you want...but it's on the right track, I think.
-
Aug 1st, 2003, 03:12 PM
#3
Thread Starter
Junior Member
Originally posted by j_jewell
Code:
Dim yRow As Integer
Dim intInserts As Integer
yRow = 1
intInserts = CInt(Application.Range("C18"))
Do Until Len(Trim(Application.Cells(yRow, 1))) = 0
yRow = yRow + 1
Loop
For i = 1 To intInserts
Rows(yRow & ":" & yRow).Select
Selection.Insert Shift:=xlDown
Next
I don't know if this is exactly what you want...but it's on the right track, I think.
wow.. that kicks much a$$... thank you so much...!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|