0

I want to remove records from a WorkSheet that is hidden and do not want to un-hide it to do so.

If it was visible, I would:

Sheets("vwReportA").Select
Rows("15:15").Select
Range(Selection, Selection.End(xlDown)).Select
Selection.Clear

How can I achieve this whilst worksheet is hidden

aSystemOverload
  • 2,994
  • 18
  • 49
  • 73

2 Answers2

4

Using Select like this is not necassary. See this answer for ideas on avoiding Select

Try this

Dim sh as WorkSheet
Dim rng as Range
Set sh = Sheets("vwReportA")
Set rng = sh.[A15]
sh.Range(rng, rng.End(xlDown)).EntireRow.Clear
Community
  • 1
  • 1
chris neilsen
  • 52,446
  • 10
  • 84
  • 123
2

Just try this:

Dim r As Range
Set r = Sheets("vwReportA").Rows("15:15")
Range(r, r.End(xlDown)).Clear
Enigmativity
  • 113,464
  • 11
  • 89
  • 172