Clear content below search dynamically

whatitdo

New Member
Joined
Jul 24, 2019
Messages
4
Hi

is it possible to make clearcontent dynamic such that it clears the content below a certain word search?

Thing is i get alot of data sent my way every month and i've made a makro which transfers all that data unto another workbook which then do the calculation etc.

problem is though at the end of every table sent (size varies) is put in an additional row i would like to have cleared, plus everything below that row, as that is the old data.

with the code:


Dim Found As Range

Set Found = Worksheets("Result").Cells.Find(What:="(tom)", LookAt:=xlWhole, MatchCase:=True)

If Not Found Is Nothing Then
ActiveCell.EntireRow.ClearContents


End If



i find the word/string (tom) in the sheet and clears it but that will not delete every row below and since the tables varies i cannot simply add a range. Any suggestions?
 

Excel Facts

Does the VLOOKUP table have to be sorted?
No! when you are using an exact match, the VLOOKUP table can be in any order. Best-selling items at the top is actually the best.
Hi,
welcome to forum

try this update to your code & see if does what you want

Code:
    Dim Found As Range
    With Worksheets("Result")
        Set Found = .Cells.Find(What:="(tom)", LookAt:=xlWhole, MatchCase:=True)
        If Not Found Is Nothing Then .Range(Found, Found.End(xlDown)).EntireRow.Delete
    End With

Dave
 
Upvote 0
I have a related question if anybody won't mind

I use this code to transfer my data from one workbook to another:


Windows("IK-periode 26.xlsm").Activate
Sheets("Result").Select
Range("B6:G6").Select
Range(Selection, Selection.End(xlDown)).Select
Selection.Copy
Windows("Arbejdsfil v2 - IKS (TESTER).xlsm").Activate
Sheets("Result").Select
Range("C4").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False



What I need is the IK-periode 26 referencing/linking to be dynamic if possible… usually the next file have a similiar name (the number in the end usually change as it represents week number)
Is it possible to for example make a linking in the workbook (arbejdsfil v2) to the new workbook file from the desktop and then reference the cell with the link or something? Other options is welcome too
 
Upvote 0
Hi,
As this is different to your first question, suggest you start a new thread as likely to gain more responses.

Dave
 
Upvote 0

Forum statistics

Threads
1,223,723
Messages
6,174,108
Members
452,544
Latest member
aush

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top