Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
That's got it. Thanks very much Steve.
Nice one -- Traa Dy Liooar Jock "Steve Yandl" wrote: Don't know how I got Application.EnableEvents = True in there twice but it seemed to work when I tested. Try what I've got below instead. Private Sub Worksheet_SelectionChange(ByVal Target As Range) Dim rngTempX As Range Dim rngTempEnd As Range Dim rngTempA As Range Dim rngTempAend Dim rngTempB As Range Dim rngTempBend As Range If Target.Column = 3 Then Application.EnableEvents = False If Target.Row 1 Then If Target.Offset(-1, 0).Text = "" Then If Not Target.Offset(-1, 1).Text = "" Then Set rngTempAend = Cells(Target.Row - 1, 256).End(xlToLeft) Set rngTempA = Range(Target.Offset(-1, 1).Address & ":" & rngTempAend.Address) rngTempA.Cut Destination:=Target.Offset(-1, 0) End If End If End If If Target.Offset(1, 0).Text = "" Then If Not Target.Offset(1, 1).Text = "" Then Set rngTempBend = Cells(Target.Row + 1, 256).End(xlToLeft) Set rngTempB = Range(Target.Offset(1, 1).Address & ":" & rngTempBend.Address) rngTempB.Cut Destination:=Target.Offset(1, 0) End If End If If Not Target.Text = "" Then Set rngTempEnd = Cells(Target.Row, 256).End(xlToLeft) Set rngTempX = Range(Target.Address & ":" & rngTempEnd.Address) rngTempX.Cut Destination:=Target.Offset(0, 1) End If Application.EnableEvents = True End If End Sub |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Move cell contents with macro | Excel Discussion (Misc queries) | |||
Move cell contents to another column IF | Excel Programming | |||
move cell contents | Excel Discussion (Misc queries) | |||
Macro to remove contents of cell and move all other contents up one row | Excel Discussion (Misc queries) | |||
How to move cell contents | Excel Discussion (Misc queries) |