Ive been trying to figure out how to find the next empty row in an excel spreadsheet.
My project is a VB project, written in Visual Studio 2010 Express.
What i need to do is open the spreadsheet (that is predefined) and find the next available row. (in column A through to S)
My code so far for this little part of my prject is:
Dim xlApp As Excel.Application Dim xlWorkBook As Excel.Workbook Dim xlworksheet As Excel.Worksheet xlApp = New Excel.Application xlWorkBook = xlApp.Workbooks.Open(giftDirectory & "\Register.xls") xlworksheet = xlWorkBook.Worksheets(1)
So ive been trying for hours to select the next available row.
Using "Range" and "Cells" but nothing seems to work.
Something like this:
Range("A1").Select Selection.End(xlDown).Select ActiveCell.Offset(1, 0).Select
When i use "Selection" it puts a blue squiggly line under it.
Dim rng As Range rng = ActiveCell.SpecialCells(xlLastCell)
The same as "Selection". I get a blue line for "ActiveCell"
Can anybody give me an explanation? or guide me as to why i cant do this?
Edited 4 Years Ago by Gobble45: Clarifying..