Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Search and destroy

Hi
I'm trying to write a macro to search for something then move one rwo and
then delete two rows.

I can do the search and the delete but I cannot do the move and the
selecting of two rows!

Any ideas please but I lose any more sleep?

Thanks
MB
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Search and destroy

Post your code so we have some idea of what technique you are using to
search and so forth.

--
regards,
Tom Ogilvy

"Pugwyrm" wrote in message
...
Hi
I'm trying to write a macro to search for something then move one rwo and
then delete two rows.

I can do the search and the delete but I cannot do the move and the
selecting of two rows!

Any ideas please but I lose any more sleep?

Thanks
MB



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Search and destroy

OK, this is what I have so far (and I've only got this far by Recording a
macro...)

Range("A1").Select
Cells.Find(What:="No History", After:=ActiveCell, LookIn:=xlFormulas, _
LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False).Activate
Rows("4:5").Select
Selection.Delete Shift:=xlUp

Its the "Rows("4:5").Select that I need to automate as it won't always be
rows 4 and 5

Thanks

"Tom Ogilvy" wrote:

Post your code so we have some idea of what technique you are using to
search and so forth.

--
regards,
Tom Ogilvy

"Pugwyrm" wrote in message
...
Hi
I'm trying to write a macro to search for something then move one rwo and
then delete two rows.

I can do the search and the delete but I cannot do the move and the
selecting of two rows!

Any ideas please but I lose any more sleep?

Thanks
MB




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Search and destroy

Dim rng as Range
Range("A1").Select
set rng =Cells.Find(What:="No History", After:=ActiveCell,
LookIn:=xlFormulas, _
LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False)
if not rng is nothing then
rng.offset(2,0).Resize(2).EntireRow.Delete
End If

if there will be multiple occurances of "No History"

Dim rng as Range
Range("A1").Select
set rng =Cells.Find(What:="No History", _
After:=Range("A65536"), _
LookIn:=xlFormulas, _
LookAt:=xlPart, _
SearchOrder:=xlByRows, _
SearchDirection:=xlNext, _
MatchCase:=False, _
SearchFormat:=False)
if not rng is nothing then
frow = rng.row
do
rng.offset(2,0).Resize(2).EntireRow.Delete
set rng = cell.findnext(rng)
Loop while rng.row fRow
End If


"Pugwyrm" wrote in message
...
OK, this is what I have so far (and I've only got this far by Recording a
macro...)

Range("A1").Select
Cells.Find(What:="No History", After:=ActiveCell, LookIn:=xlFormulas,

_
LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False).Activate
Rows("4:5").Select
Selection.Delete Shift:=xlUp

Its the "Rows("4:5").Select that I need to automate as it won't always be
rows 4 and 5

Thanks

"Tom Ogilvy" wrote:

Post your code so we have some idea of what technique you are using to
search and so forth.

--
regards,
Tom Ogilvy

"Pugwyrm" wrote in message
...
Hi
I'm trying to write a macro to search for something then move one rwo

and
then delete two rows.

I can do the search and the delete but I cannot do the move and the
selecting of two rows!

Any ideas please but I lose any more sleep?

Thanks
MB






  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Search and destroy

Cheers, it's a start!

"Tom Ogilvy" wrote:

Dim rng as Range
Range("A1").Select
set rng =Cells.Find(What:="No History", After:=ActiveCell,
LookIn:=xlFormulas, _
LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False)
if not rng is nothing then
rng.offset(2,0).Resize(2).EntireRow.Delete
End If

if there will be multiple occurances of "No History"

Dim rng as Range
Range("A1").Select
set rng =Cells.Find(What:="No History", _
After:=Range("A65536"), _
LookIn:=xlFormulas, _
LookAt:=xlPart, _
SearchOrder:=xlByRows, _
SearchDirection:=xlNext, _
MatchCase:=False, _
SearchFormat:=False)
if not rng is nothing then
frow = rng.row
do
rng.offset(2,0).Resize(2).EntireRow.Delete
set rng = cell.findnext(rng)
Loop while rng.row fRow
End If


"Pugwyrm" wrote in message
...
OK, this is what I have so far (and I've only got this far by Recording a
macro...)

Range("A1").Select
Cells.Find(What:="No History", After:=ActiveCell, LookIn:=xlFormulas,

_
LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False).Activate
Rows("4:5").Select
Selection.Delete Shift:=xlUp

Its the "Rows("4:5").Select that I need to automate as it won't always be
rows 4 and 5

Thanks

"Tom Ogilvy" wrote:

Post your code so we have some idea of what technique you are using to
search and so forth.

--
regards,
Tom Ogilvy

"Pugwyrm" wrote in message
...
Hi
I'm trying to write a macro to search for something then move one rwo

and
then delete two rows.

I can do the search and the delete but I cannot do the move and the
selecting of two rows!

Any ideas please but I lose any more sleep?

Thanks
MB








Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Destroy command button with a Macro? grasping@straws Excel Discussion (Misc queries) 3 December 22nd 04 02:30 PM
Create a search Field within a worksheet to search command buttons Ed P[_2_] Excel Programming 1 December 14th 04 08:04 PM
How to make VBA code to self-destroy itself? count Excel Programming 6 November 10th 04 05:11 PM
Inserting lines that don't destroy macros Ali K Excel Programming 1 October 27th 04 01:37 PM
Seek and destroy [email protected] Excel Programming 7 December 3rd 03 08:41 PM


All times are GMT +1. The time now is 11:30 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"