ClearIng Data

howard

Well-known Member
Joined
Jun 26, 2006
Messages
6,601
Office Version
  1. 2021
Platform
  1. Windows
I Have a worksheet where i would like to clear the data from where "totals" appears in Col A to 9 rows below and 3 columns to the right per the attached sample

<b>Sheet1</b><br /><br /><table border="1" cellspacing="0" cellpadding="0" style="font-family:Arial,Arial; font-size:10pt; background-color:#ffffff; padding-left:2pt; padding-right:2pt; "> <colgroup><col style="font-weight:bold; width:30px; " /><col style="width:86px;" /><col style="width:215px;" /><col style="width:113px;" /></colgroup><tr style="background-color:#cacaca; text-align:center; font-weight:bold; font-size:8pt; "><td >*</td><td >A</td><td >B</td><td >C</td></tr><tr style="height:18px ;" ><td style="font-size:8pt; background-color:#cacaca; text-align:center; " >14</td><td style="background-color:#ece9d8; font-weight:bold; text-align:left; border-top-style:solid; border-bottom-style:solid; border-top-width:2px; border-bottom-width:2px; border-top-color:#000000; border-bottom-color:#000000; ">Totals</td><td style="background-color:#ece9d8; border-top-style:solid; border-bottom-style:solid; border-top-width:2px; border-bottom-width:2px; border-top-color:#000000; border-bottom-color:#000000; ">*</td><td style="background-color:#ece9d8; border-top-style:solid; border-bottom-style:solid; border-top-width:2px; border-bottom-width:2px; border-top-color:#000000; border-bottom-color:#000000; ">*</td></tr><tr style="height:17px ;" ><td style="font-size:8pt; background-color:#cacaca; text-align:center; " >15</td><td style="background-color:#ece9d8; border-left-style:solid; border-left-width:2px; border-left-color:#000000; ">*</td><td style="background-color:#ece9d8; ">*</td><td style="background-color:#ece9d8; border-right-style:solid; border-right-width:2px; border-right-color:#000000; ">*</td></tr><tr style="height:17px ;" ><td style="font-size:8pt; background-color:#cacaca; text-align:center; " >16</td><td style="background-color:#ece9d8; font-weight:bold; text-align:left; border-left-style:solid; border-left-width:2px; border-left-color:#000000; ">Ageing 7 days & Less</td><td style="background-color:#ece9d8; ">*</td><td style="background-color:#ece9d8; font-weight:bold; text-align:right; border-right-style:solid; border-right-width:2px; border-right-color:#000000; ">0.00</td></tr><tr style="height:17px ;" ><td style="font-size:8pt; background-color:#cacaca; text-align:center; " >17</td><td style="background-color:#ece9d8; border-left-style:solid; border-left-width:2px; border-left-color:#000000; ">*</td><td style="background-color:#ece9d8; ">*</td><td style="background-color:#ece9d8; border-right-style:solid; border-right-width:2px; border-right-color:#000000; ">*</td></tr><tr style="height:17px ;" ><td style="font-size:8pt; background-color:#cacaca; text-align:center; " >18</td><td style="background-color:#ece9d8; font-weight:bold; text-align:left; border-left-style:solid; border-left-width:2px; border-left-color:#000000; ">Ageing > 7 Days</td><td style="background-color:#ece9d8; ">*</td><td style="background-color:#ece9d8; font-weight:bold; text-align:right; border-right-style:solid; border-right-width:2px; border-right-color:#000000; ">716,745.08</td></tr><tr style="height:17px ;" ><td style="font-size:8pt; background-color:#cacaca; text-align:center; " >19</td><td style="background-color:#ece9d8; border-left-style:solid; border-left-width:2px; border-left-color:#000000; ">*</td><td style="background-color:#ece9d8; ">*</td><td style="background-color:#ece9d8; border-right-style:solid; border-right-width:2px; border-right-color:#000000; ">*</td></tr><tr style="height:17px ;" ><td style="font-size:8pt; background-color:#cacaca; text-align:center; " >20</td><td style="background-color:#ece9d8; font-weight:bold; text-align:left; border-left-style:solid; border-left-width:2px; border-left-color:#000000; ">Total Ageing</td><td style="background-color:#ece9d8; ">*</td><td style="background-color:#ece9d8; font-weight:bold; text-align:right; border-right-style:solid; border-right-width:2px; border-right-color:#000000; ">716,745.08</td></tr><tr style="height:18px ;" ><td style="font-size:8pt; background-color:#cacaca; text-align:center; " >21</td><td style="background-color:#ece9d8; border-bottom-style:solid; border-left-style:solid; border-bottom-width:2px; border-left-width:2px; border-bottom-color:#000000; border-left-color:#000000; ">*</td><td style="background-color:#ece9d8; border-bottom-style:solid; border-bottom-width:2px; border-bottom-color:#000000; ">*</td><td style="background-color:#ece9d8; border-right-style:solid; border-bottom-style:solid; border-right-width:2px; border-bottom-width:2px; border-right-color:#000000; border-bottom-color:#000000; ">*</td></tr><tr style="height:18px ;" ><td style="font-size:8pt; background-color:#cacaca; text-align:center; " >22</td><td style="background-color:#ece9d8; font-weight:bold; text-align:left; border-bottom-style:solid; border-left-style:solid; border-bottom-width:2px; border-left-width:2px; border-bottom-color:#000000; border-left-color:#000000; ">Variance</td><td style="background-color:#ece9d8; border-bottom-style:solid; border-bottom-width:2px; border-bottom-color:#000000; ">*</td><td style="background-color:#ece9d8; font-weight:bold; text-align:right; border-right-style:solid; border-bottom-style:solid; border-right-width:2px; border-bottom-width:2px; border-right-color:#000000; border-bottom-color:#000000; ">0.00</td></tr><tr style="height:17px ;" ><td style="font-size:8pt; background-color:#cacaca; text-align:center; " >23</td><td style="background-color:#ece9d8; ">*</td><td style="background-color:#ece9d8; ">*</td><td style="background-color:#ece9d8; ">*</td></tr></table><br /><table style="font-family:Arial; font-size:10pt; border-style: groove ;border-color:#00ff00;background-color:#fffcf9; color:#000000; "><tr><td ><b>Spreadsheet Formulas</b></td></tr><tr><td ><table border = "1" cellspacing="0" cellpadding="2" style="font-family:Arial; font-size:9pt;"><tr style="background-color:#cacaca; font-size:10pt;"><td >Cell</td><td >Formula</td></tr><tr><td >C16</td><td >=SUMIF(F5:F10,"<=7",C5:C10)</td></tr><tr><td >C18</td><td >=SUMIF(F5:F10,">7",C5:C10)</td></tr><tr><td >C20</td><td >=SUM(C16:C19)</td></tr><tr><td >C22</td><td >=SUM(C6:C10) - C20</td></tr></table></td></tr></table> <br />Excel tables to the web - Excel Jeanie Html 4
 

Excel Facts

Repeat Last Command
Pressing F4 adds dollar signs when editing a formula. When not editing, F4 repeats last command.
Try

Code:
Sub ClearTotals()
Dim Found As Range
Set Found = Columns("A").Find(what:="Totals", LookIn:=xlValues, lookat:=xlWhole)
If Not Found Is Nothing Then Found.Resize(9, 3).ClearContents
End Sub
 
Upvote 0
Hi Peter

Thanks for the help, much appreciated
 
Upvote 0

Forum statistics

Threads
1,224,566
Messages
6,179,553
Members
452,928
Latest member
101blockchains

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