S
StargateFanFromWork
I have this code that works perfectly on most spreadsheets as there are
usually no empty rows (most times there shouldn't be empty rows):
********************************************************************************************************
Sub AddNewEntry()
'
Dim iLastRow As Integer
ActiveSheet.Unprotect 'place at the beginning of the code
iLastRow = Range("A65536").End(xlUp).Row
If iLastRow <> 1 Then
Range("A" & iLastRow).Select
ActiveCell.Offset(0, 1).Select
ActiveCell.Offset(0, -1).Select
ActiveCell.Offset(1, 0).Select
Else
Range("A2").Select
ActiveCell.Offset(0, 1).Select
ActiveCell.Offset(0, -1).Select
End If
ActiveSheet.Protect ' place at end of code
End Sub
********************************************************************************************************
But a new spreadsheet requires something a little different. I need to
leave blank lines in between "subjects", as it were. Though the "groupings"
are informal, it's been easier to keep things organized in this sheet this
way as the info is temporary and the information in these lists gets moved
around or deleted or changed. Is there a piece of code that can skip over
filled rows, re entries in column A, till the next empty row is reached. So
that it sort of jumps over filled rows to get to next empty row every time
we press the button?
Thanks!
D
usually no empty rows (most times there shouldn't be empty rows):
********************************************************************************************************
Sub AddNewEntry()
'
Dim iLastRow As Integer
ActiveSheet.Unprotect 'place at the beginning of the code
iLastRow = Range("A65536").End(xlUp).Row
If iLastRow <> 1 Then
Range("A" & iLastRow).Select
ActiveCell.Offset(0, 1).Select
ActiveCell.Offset(0, -1).Select
ActiveCell.Offset(1, 0).Select
Else
Range("A2").Select
ActiveCell.Offset(0, 1).Select
ActiveCell.Offset(0, -1).Select
End If
ActiveSheet.Protect ' place at end of code
End Sub
********************************************************************************************************
But a new spreadsheet requires something a little different. I need to
leave blank lines in between "subjects", as it were. Though the "groupings"
are informal, it's been easier to keep things organized in this sheet this
way as the info is temporary and the information in these lists gets moved
around or deleted or changed. Is there a piece of code that can skip over
filled rows, re entries in column A, till the next empty row is reached. So
that it sort of jumps over filled rows to get to next empty row every time
we press the button?
Thanks!