+ Reply to Thread
Results 1 to 14 of 14

VBA to insert data in the first empty row (not last rows)

  1. #1
    Registered User
    Join Date
    03-19-2013
    Location
    Toronto,Canada
    MS-Off Ver
    Excel 2010
    Posts
    60

    VBA to insert data in the first empty row (not last rows)

    Hello everybody,

    I have a work sheet ("Sheet2"), range (B2:F8) with no merged cells. I like to insert data from a userform text box called (Name) in the FIRST empty row of this range. I tried this code which is perfect to localize the first empty cell of the row, however it failed to insert the data. If you any idea to help me, it will be really appreciated.

    HTML Code: 

    Thank you and stay safe

  2. #2
    Forum Expert Logit's Avatar
    Join Date
    12-23-2012
    Location
    North Carolina
    MS-Off Ver
    Excel 2019 Professional Plus - 2007 Enterprise
    Posts
    7,442

    Re: VBA to insert data in the first empty row (not last rows)

    .
    From your description what you are saying is that TEXTBOX: txbName.Text is holding 7 words that you want to paste into
    cells B2:B8 ... is that correct ?

  3. #3
    Registered User
    Join Date
    03-19-2013
    Location
    Toronto,Canada
    MS-Off Ver
    Excel 2010
    Posts
    60

    Re: VBA to insert data in the first empty row (not last rows)

    Hello Logit,

    Thank you so much for your reply. Actually, I like to type some words in ("txbName") TEXTBOX, then to insert these words. by clicking a command button, in the first single empty cell of the range ("B2:B8"). and repeat it for anothe TEXTBOX to insert them in the next empty cell of the range ("C2:C8") and so on up to range ("F2:F" ). So in this figure, I a formula to select and insert data in row 4 cells.Attachment 676091

    Take care

  4. #4
    Registered User
    Join Date
    03-19-2013
    Location
    Toronto,Canada
    MS-Off Ver
    Excel 2010
    Posts
    60

    Re: VBA to insert data in the first empty row (not last rows)

    I mean 7 TEXTBOXES to insert data in 7 CELLS of the selected row

  5. #5
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,834

    Re: VBA to insert data in the first empty row (not last rows)

    First empty row of B2:F8....

    a bit confusing.
    If find first empty cell in B2:B8 then simply
    Please Login or Register  to view this content.

  6. #6
    Registered User
    Join Date
    03-19-2013
    Location
    Toronto,Canada
    MS-Off Ver
    Excel 2010
    Posts
    60

    Re: VBA to insert data in the first empty row (not last rows)

    Hello Jindon,

    Thank you so much for your reply. I have this work sheet (Sheet2), and I like to insert data from 7 TEXTBOXES into the cells of the first empty row.Attachment 676092

    Stay safe

  7. #7
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,834

    Re: VBA to insert data in the first empty row (not last rows)

    Your attachments are all invalid link, so can not open.

  8. #8
    Registered User
    Join Date
    03-19-2013
    Location
    Toronto,Canada
    MS-Off Ver
    Excel 2010
    Posts
    60

    Re: VBA to insert data in the first empty row (not last rows)

    Sorry, it is only 5 TEXTBOXES for 5 Cells of same row

  9. #9
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,834

    Re: VBA to insert data in the first empty row (not last rows)

    Perhaps something like
    Please Login or Register  to view this content.
    TextBoxName should be replaced with the appropriate names....

  10. #10
    Registered User
    Join Date
    03-19-2013
    Location
    Toronto,Canada
    MS-Off Ver
    Excel 2010
    Posts
    60

    Re: VBA to insert data in the first empty row (not last rows)

    Sorry , I hope you cane get the image now
    Attached Images Attached Images

  11. #11
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,834

    Re: VBA to insert data in the first empty row (not last rows)

    That's what the code I last posted should do.

  12. #12
    Registered User
    Join Date
    03-19-2013
    Location
    Toronto,Canada
    MS-Off Ver
    Excel 2010
    Posts
    60

    Re: VBA to insert data in the first empty row (not last rows)

    Hello jindon

    thank you so much it works and I got very perfect result. Really appreciated.

    Have a wonderful day

  13. #13
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,834

    Re: VBA to insert data in the first empty row (not last rows)

    You are welcome and same to you.

    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED.

  14. #14
    Registered User
    Join Date
    03-19-2013
    Location
    Toronto,Canada
    MS-Off Ver
    Excel 2010
    Posts
    60

    Re: VBA to insert data in the first empty row (not last rows)

    Hello Jindon,

    It is done

    Karim

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 0
    Last Post: 09-18-2019, 05:41 AM
  2. Insert set number of rows between data and copy and paste data above empty rows
    By Orionm45 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-21-2017, 11:35 AM
  3. Insert multiple empty rows
    By mandura in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 03-25-2015, 07:47 AM
  4. [SOLVED] vba insert empty rows into worksheets
    By vio.coman in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 09-17-2014, 07:25 AM
  5. insert two empty rows below used data
    By johncena in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 07-01-2010, 05:49 AM
  6. insert 1 empty row after 100 rows
    By vinz20k in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-31-2007, 03:52 AM
  7. Macro To Insert Empty Rows??
    By rtidrtid in forum Excel General
    Replies: 1
    Last Post: 02-03-2006, 11:20 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1