View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.newusers
Gord Dibben Gord Dibben is offline
external usenet poster
 
Posts: 22,906
Default TRANSPOSE & DELETE

Rudy

A formula cannot delete anything, only return values.

The term "Transpose" is not correct in this case.

Transpose in Excel is to change orientation from east-west to north-south or
opposite.

You just want cells in N12:N500 cut and pasted to cells in O12:O50 which is a
"transfer"

Change the code to..................

Private Sub Worksheet_Change(ByVal Target As Range)
On Error GoTo endit
If Intersect(Target, Range("C12:C500")) Is Nothing Then Exit Sub
Application.EnableEvents = False
For Each cell In Target
If Target.Value = "C" And Target.Offset(0, 11) _
.Value < "" Then
With Target
.Offset(0, 12).Value = Target.Offset(0, 11).Value
.Offset(0, 11).ClearContents
End With
End If
Next
endit:
Application.EnableEvents = True
End Sub

Right-click on the sheet tab and "View Code". Copy/paste the code into the
module that opens.

Alt + q to return to Excel.

With data in N12:N500 start entering letters in column C.

Whenever you enter a "C" the data in N will go to O.


Gord Dibben MS Excel MVP



On Sat, 12 Jan 2008 05:44:00 -0800, Rudy wrote:

Thanks but to be honest, I am not yet too familiar with VBE. A simple formula
would do fine with me. BTW, I made a mistake in saying that I will requote
again:

If E12:E500 = "C", the value in N12:N500 are to be transpose to O12:O500,
then delete N12:N500 value. Sorry about that.

rgds,

rudy



"Gary''s Student" wrote:

Put the following sub in the worksheet code area:

Private Sub Worksheet_Change(ByVal Target As Range)
If Intersect(Target, Range("C2")) Is Nothing Then Exit Sub
If Target.Value < "C" Then Exit Sub
Application.EnableEvents = False
Range("N2").Copy Range("O2")
Range("N2").Clear
Application.EnableEvents = True
End Sub

REMEMBER: the worksheet code area, not a standard module.
--
Gary''s Student - gsnu200765


"Rudy" wrote:

Hi,

Can someone assist pls. Here's the scenario:

IF C2=C, the value in N2 is to be transpose to O2 then delete N2 value.

thanks,

rudy