ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   move cells that meet a certain criteria to the row below (https://www.excelbanter.com/excel-programming/432444-move-cells-meet-certain-criteria-row-below.html)

Donna[_2_]

move cells that meet a certain criteria to the row below
 
I want my macro to do the following: If Column E2="COA" I want it to move
COA to E3.

Dave Peterson

move cells that meet a certain criteria to the row below
 
There are a few choices.

If you mean the equivalent of Cut|paste:

Option Explicit
Sub testme()
With ActiveSheet
If LCase(.Range("e2").Value) = LCase("COA") Then
.Range("e2").Cut _
Destination:=.Range("E3")
End If
End With
End Sub

If you mean just reassign the value, you coul use:

Option Explicit
Sub testme2()
With ActiveSheet
If LCase(.Range("e2").Value) = LCase("COA") Then
.Range("E3").value = .range("E2").value
.range("e2").value = ""
End If
End With
End Sub

Donna wrote:

I want my macro to do the following: If Column E2="COA" I want it to move
COA to E3.


--

Dave Peterson


All times are GMT +1. The time now is 02:28 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com