If statement to move data from one column to another
Sub Move_Stuff()
Dim topCel As Range
Dim bottomCel As Range
whatval = InputBox("Enter a Value")
Set topCel = Range("A1")
Set bottomCel = Cells((65536), topCel.Column).End(xlUp)
If bottomCel.Row = topCel.Row Then
With Range(topCel, bottomCel)
Set c = .Find(whatval, LookIn:=xlValues, LookAt:=xlPart)
If Not c Is Nothing Then
Do
c.Cut Destination:=c.Offset(0, 1)
Set c = .FindNext
Loop While Not c Is Nothing
End If
End With
End If
End Sub
Gord Dibben MS Excel MVP
On 20 Jan 2007 12:27:57 -0800, "tmeakin" wrote:
how could you automate this so it would check each cell in column a and
move data to column b based on =if
John Bundy (remove) wrote:
you could do it with code or a function, function would be easiest, in B1 type
=IF(A1="frog",A1,"")
replace frog with whatever you are looking for or another cell, copy all the
way to the bottom of the column
--
-John Northwest11
Please rate when your question is answered to help us and others know what
is helpful.
"tmeakin" wrote:
Hi,
I am a new user to excel. I am interested in a macro or vba code to
look through column a for specific data and if it finds it move it to
column b. any help would be greatly appreicated.
|