View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Pluggie Pluggie is offline
external usenet poster
 
Posts: 23
Default Delete records from result-cell after a find-function call

Part of my macro needs to delete records starting from a row which is
determined by a find-function call. Naturally... the resultcell of this
find-function will vary each time.
How do I make sure that the resultcell of the first recorded instance of the
macro is not hardcoded into the macro?

Here is the sample of code I have now (last 7 rows of the code).
This should be modified so that it does what I want.

----------------------------code----------------------------------
Columns("A:A").Select
Selection.Insert Shift:=xlToRight
Range("A2").Select
ActiveCell.FormulaR1C1 = "1"
Range("A3").Select
ActiveCell.FormulaR1C1 = "2"
Range("A2:A3").Select
Dim LastRow2 As Long
LastRow2 = Range("G" & Rows.Count).End(xlUp).Row
Selection.AutoFill Destination:=Range("A2:A" & LastRow2)
Rows("2:2").Select
Range(Selection, Selection.End(xlDown)).Select
Selection.Sort Key1:=Range("B2"), Order1:=xlAscending, Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal
Columns("B:B").Select
Selection.Find(What:="2", After:=ActiveCell, LookIn:=xlFormulas, LookAt _
:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext,
MatchCase:= _
False, SearchFormat:=False).Activate
Range("C202:F202").Select
Range(Selection, Selection.End(xlDown)).Select
Selection.ClearContents
----------------------------end-of-code-----------------------------

Anybody have the solution?

Regards,

Pluggie.