Clear Data within Range

pawcoyote

Board Regular
Joined
Mar 5, 2012
Messages
89
Office Version
  1. 365
Platform
  1. Windows
Hi, I built the below to be able to clear data on various worksheets starting just below the main header line. What I am missing is how to be able to start the clear in a different cell/Column on each sheet. Meaning on one sheet the clear starts in B11 and on others it might start in C2. All the Headers start in Row 10 and all Data starts on row 11.

Global Code is below to show where the Headers are and where the Data starts
VBA Code:
Option Explicit
Public Const rowHeaderInstall As Long = 10
Public Const rowDataStartInstall As Long = 11

Public headerInstall As Range

Public rowDataEnd Install As Long

Public wsInstall

Public rInstall As Range

The Clear Data info
VBA Code:
Option Explicit
Sub Clear_Install
Set wsInstall = Worksheets("Install")
If msgBox("Are you sure you want to clear all the data on " & wsInstall.Name  & "???", vbQuestion + vbYesNo + vbDefaultButton2, "Clear " & wsInstall.Name) = vbNo Then Exit Sub
With wsInstall
Range (.Rows(rowDataStartInstall), .Rows(.UsedRange.Rows.Count)).ClearContents
End With
End Sub

Thank you for any guidance.
 

Excel Facts

Enter current date or time
Ctrl+: enters current time. Ctrl+; enters current date. Use Ctrl+: Ctrl+; Enter for current date & time.
on one sheet the clear starts in B11 and on others it might start in C2. All the Headers start in Row 10 and all Data starts on row 11.
Your problem is not very clear. you say the data needs to be cleared from row 11, but you also say it may be from b11 or C2. So what is it?

Is there maybe a common word in all of the heaers that can be searched for to define the header row, and delete below it?
 
Upvote 0

Forum statistics

Threads
1,214,643
Messages
6,120,702
Members
448,980
Latest member
CarlosWin

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