Results 1 to 3 of 3

Thread: Insert as many rows as it says in cell c18

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Jul 2003
    Posts
    27

    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.

  2. #2
    Hyperactive Member
    Join Date
    May 2002
    Location
    Omaha, NE
    Posts
    263
    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.

  3. #3

    Thread Starter
    Junior Member
    Join Date
    Jul 2003
    Posts
    27
    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
  •  



Click Here to Expand Forum to Full Width