1. Computer problem? Tech Support Guy is completely free -- paid for by advertisers and donations. Click here to join today! If you're new to Tech Support Guy, we highly recommend that you visit our Guide for New Members.

excel marco programming detecting blank row

Discussion in 'Business Applications' started by racerrunner, May 14, 2006.

Thread Status:
Not open for further replies.
Advertisement
  1. racerrunner

    racerrunner Thread Starter

    Joined:
    May 14, 2006
    Messages:
    3
    hi to all,

    i'm writting a marco to populate the row and col in the spreadsheet. I provide an form interface for the user to key in the data before reflect the data in the spreadsheet. my question is how do i detect the first blank row and transfer the data into that blank row in the spreadsheet.

    i only have 9 columns and therefore i hardcode the colum, however, i need to find the blank rows so as to insert the data.

    Cells(currentRow, 1) = txtTime.Text
    Cells(currentRow, 1) = txtDate.Text

    can someone tell me how to fiind the index of the rows???????

    Thank in advance
     
  2. bomb #21

    bomb #21

    Joined:
    Jul 1, 2005
    Messages:
    8,546
    The code you have writes txtTime and txtDate to the same cell. Try:

    newrow = Range("A65536").End(xlUp).Row + 1
    Cells(newrow, 1) = txtTime.Text
    Cells(newrow, 2) = txtDate.Text

    , assuming you have at least one row already.

    I couldn't tell you what data type to use for newrow. Zack could tho', he might drop by later.

    HTH,
    bomb
     
  3. racerrunner

    racerrunner Thread Starter

    Joined:
    May 14, 2006
    Messages:
    3
    Hi bomb,

    Thank you for replying to my two threads.
     
  4. Zack Barresse

    Zack Barresse

    Joined:
    Jul 25, 2004
    Messages:
    5,452
    Hi, use Long type. And change ..

    Code:
    newrow = Range("A65536").End(xlUp).Row + 1
    .. to this ..

    Code:
    newrow = Cells(Rows.Count, 1).End(xlup).Row + 1
    That assumes there is no data in A65536 or whatever your last row would be. This is XL 97-2007 compliant as well.

    HTH
     
As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 733,556 other people just like you!

Loading...
Thread Status:
Not open for further replies.

Short URL to this thread: https://techguy.org/467101

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice