Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.misc
|
|||
|
|||
select next empty cell
I have the following code which copies and pastes formats and formulas to the
next row. How can I make it to end with the next empty cell selected. Private Sub Worksheet_SelectionChange(ByVal Target As Range) Dim lastrow As Long If Target.Column < 1 Then Exit Sub If Target.Row < 2 Then Exit Sub If Not IsEmpty(Target) Then Exit Sub 'cell must be empty lastrow = Cells(Cells.Rows.Count, "A").End(xlUp).Row If Target.Row < lastrow + 1 Then Exit Sub 'Row must be empty Rows(Target.Row - 1).Copy ActiveSheet.Paste Application.CutCopyMode = False On Error Resume Next Target.EntireRow.SpecialCells(xlConstants).ClearCo ntents Application.EnableEvents = False 'should be part of change macro Target.Select Application.EnableEvents = True 'should be part of change macro End Sub -- ASU |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
select last cell in a dynamic list using a macro | Excel Discussion (Misc queries) | |||
Refering to an empty cell | Excel Discussion (Misc queries) | |||
Urgent date/scheduling calc needed | Excel Worksheet Functions | |||
enhanced conditional formatting | Excel Discussion (Misc queries) | |||
Text wider than one cell is not displayed in the next empty cell | Excel Discussion (Misc queries) |