Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.misc
|
|||
|
|||
create
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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
create self-generating numbers with letters and numbers | Excel Discussion (Misc queries) | |||
Create database in excel? | New Users to Excel | |||
quickly create extra copies of a worksheet template in a workbook | Excel Worksheet Functions | |||
need to create a formula to create a timesheet but haven't a clue | Excel Discussion (Misc queries) | |||
Create a tabular control | Excel Discussion (Misc queries) |