View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.misc
Mike Mike is offline
external usenet poster
 
Posts: 3,101
Default Find and Move Data

try this
Sub OpenTime()
Dim strdummy As String

Cells.Find(What:="OPENTIME", After:=ActiveCell, LookIn:=xlValues, LookAt _
:=xlWhole, SearchOrder:=xlByColumns, SearchDirection:=xlNext,
MatchCase _
:=False, SearchFormat:=False).Activate
Range(Selection, Selection.End(xlToRight)).Select
Selection.Cut
Range(Selection, Selection.End(xlDown)).Select
strdummy = "dummy to get this to work"

If ActiveCell.Value = strdummy Then
'
ActiveCell.Offset(1, 0).Select
End If
If ActiveCell < "" Then


Selection.End(xlDown).Select
ActiveCell.Offset(1, 0).Select
End If

ActiveSheet.Paste
Range("A2").Select

End Sub

"Stan" wrote:

Many apologies for not being clear. I need the row that contains "Open Time"
to go to the bottom of the list in column 'A' or as you say the next blank
cell in the column.

"FSt1" wrote:

hi,
what do yo mean by static cell. next blank cell in the column?

regards
FSt1

"Stan" wrote:

Many thanks for the quick reply!

No, "Open Time" will only appear in column A one time. The paste location
will be in a static cell each time.

"FSt1" wrote:

hi stan,
the find part is easy but a little more info might be required.
1. does "open time" appear more that once. if so which one do you want? how
to identify?
2. where do you want it pasted? macros are pretty specific and we need a
specific, exact place to paste. the paste may vary but how to identify.
3. if your are going to be using this alot, i don't recomend that you use
cut and paste. in a macro, this causes memory problems perticularly in a
loop. you don't seem to be needing a loop but i just get squimish using cut
and paste in a macro. variables may be better and have one variable's value =
another variable's value which would avoid cut and paste all togeather.

post back with more info.

regards
FSt1

"Stan" wrote:

I've got column A with a data type of text. I'm trying to create a macro
that will find certain text ("Open Time") within column A then cut and paste
the row where "Open Time" exists into a new row.

For example, let's say "Open Time" is in cell A27. I want to find row 27
and cut and paste this row of information into say row 49. The trouble is
"Open Time" can appear in different rows each time.

Many thanks if you can help with the writing of this macro!