VBA Code...
try this code
Private Sub Worksheet_Change(ByVal Target As Range)
Charcount = 1
If Target.Column < Range("C1").Column Then Exit Sub
If StrComp(StrConv(Target, vbUpperCase), "YES") < 0 Then Exit Sub
Set FirstRange = Target.EntireRow
FirstRange.Select
FirstRange.Cut
Worksheets("Sheet2").Select
RowOffset = 0
Do While StrComp(Worksheets("Sheet2").Range("a1"). _
Offset(RowOffset:=RowOffset, columnoffset:=0), "") < 0
RowOffset = RowOffset + 1
Loop
Set SecondRange = Worksheets("Sheet2").Range("A1"). _
Offset(RowOffset:=RowOffset, columnoffset:=0).EntireRow
SecondRange.Select
SecondRange.Insert (xlShiftDown)
End Sub
"MarkHear1" wrote:
Hi all,
I want to write a VBA (Excel) code to do the following...
Recognise when "Yes" is typed into any cell in column "C" on "sheet1"
and then cut that row, and paste it into the first empty row on
"sheet2", and finally delete the row on "sheet1".
Can anybody offer any suggestions/code as to how I can achieve this?
Many thanks,
Mark
|