none
insert Row RRS feed

  • Question

  • i have a form with a text box that i enter value in it ( the value enter in text box is unique

    and a button that base on textbox.text start to search in my sheet 

    i wanna 

    if this value is in my sheet 

    a row insert below it  and insert some  data in it 

    ----->

    for EX : 

    value = 100 

    if  find it in fourth row

    insert a row below it 

    and set : 

    A5= ramin   B5 = 1989 

    Thursday, November 29, 2012 5:45 PM

All replies

  • Dim rngC As Range

    Set rngC = Worksheets("SheetName").Cells.Find(Textbox1.Text)

    If Not rngC Is Nothing Then

    rngC(2).EntireRow.Insert

     

    Worksheets("SheetName").Cells(rngC.Row +1, 1).Value = "ramin"

    Worksheets("SheetName").Cells(rngC.Row +1, 2).Value = 1989

    Else

    Msgbox Textbox1.Text & " was not found"

    End If


    Thursday, November 29, 2012 7:01 PM
  • Thank you so much 
    Friday, November 30, 2012 4:46 PM