ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Movin Columns (https://www.excelbanter.com/excel-discussion-misc-queries/163609-movin-columns.html)

saman110 via OfficeKB.com

Movin Columns
 
Hi,

This macro looks for Ln and Ave and puts them in Col. C. My problem is that I
have data in Col. C so I want the macro wherever there is a dada in Col. C it
Does not move adjusent Col. B to Col. C. any help?

Sub Move()
Range(("A1"), Range("A65500").End(xlUp)).Select
For Each x In Selection
If x.Value = "Ln" Or x.Value = "Ave" Then
x.copy Destination:=x.Offset(0, 1)
x.Clear
End If
Next
End Sub


Thx.

--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...excel/200710/1


Rick Rothstein \(MVP - VB\)

Movin Columns
 
If I understand you correctly, I think the two additional statements I have
added inline will do what you want...

This macro looks for Ln and Ave and puts them in Col. C. My problem is
that I
have data in Col. C so I want the macro wherever there is a dada in Col. C
it
Does not move adjusent Col. B to Col. C. any help?

Sub Move()
Range(("A1"), Range("A65500").End(xlUp)).Select
For Each x In Selection
If x.Value = "Ln" Or x.Value = "Ave" Then


If x.Offset(0, 1).Value = "" Then

x.copy Destination:=x.Offset(0, 1)
x.Clear


End If

End If
Next
End Sub


Thx.

--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...excel/200710/1




All times are GMT +1. The time now is 09:43 PM.

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