Hi
for column A
Cells(rows.Count,"A").End(xlUp).offset(1,0).Select
if you want the last cell in a block, but don't want to jump to a
second block in column A e.g. you have data in A2 to A10 and in A14 to
A20, but you just want the end of the A2 to A10 block then:
Range("A2").End(xldown).offset(1,0).select
regards
Paul
- Show quoted text -
Hi paul, i asked the above question so i can amend my macro. Please
see my macro below as its not working. can you please tell that what
wrong i am doing?
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim LastRow As Long
Dim StartRow As Long
Dim slc As Long
slc = Cells(Rows.Count, 2).End(xlUp).Offset(1, 0).Select
If slc <> "" Then
StartRow = Cells(Rows.Count, 2).End(xlUp).Row - 1
Cells(StartRow + 1, 1).Resize(6, 1).EntireRow.Insert
For i = 1 To 6
Cells(StartRow + i, 9).Resize(1, 6).Merge
Next i
LastRow = Cells(Rows.Count, 2).End(xlUp).Row
Application.ScreenUpdating = False
With Range(Cells(StartRow, 2), Cells(LastRow, 2))
.DataSeries Rowcol:=xlColumns, Type:=xlLinear, Date:=xlDay, _
Step:=1, Trend:=False
End With
Application.ScreenUpdating = True
End If
End Sub