JorgenKjer
Board Regular
- Joined
- Aug 1, 2016
- Messages
- 65
- Office Version
- 2013
- Platform
- Windows
Deleteselected Range in selected Sheets
Cananyone help with a code that deletes a Range starting in "A7" to bedeleted in all Sheets except two in the workbook?
Rangecan vary in number of Rows.
Afterall Sheets are deleted, cell "A7" must be active on all sheets thathave been deleted
I'vetried this code but it stops after Case Else with a Run-time error”1004” Selectmethod of Range class failed.
There issurely a better way to choose Rank "A7: K400". I just don't know how.Since only one sheet will have data until Row 400
SubClearLoop()
Dim wscl As Worksheet
For Each wscl In ActiveWorkbook.Worksheets
Select Case wscl.Name
Case "Data", "FrontPage"
' do nothing
Case Else
wscl.Range("A7:K400").Select
Application.CutCopyMode = False
Selection.Clear
Range("A7").Select
End Seleect
Nextwscl
End Sub
RegardsJorgen
Cananyone help with a code that deletes a Range starting in "A7" to bedeleted in all Sheets except two in the workbook?
Rangecan vary in number of Rows.
Afterall Sheets are deleted, cell "A7" must be active on all sheets thathave been deleted
I'vetried this code but it stops after Case Else with a Run-time error”1004” Selectmethod of Range class failed.
There issurely a better way to choose Rank "A7: K400". I just don't know how.Since only one sheet will have data until Row 400
SubClearLoop()
Dim wscl As Worksheet
For Each wscl In ActiveWorkbook.Worksheets
Select Case wscl.Name
Case "Data", "FrontPage"
' do nothing
Case Else
wscl.Range("A7:K400").Select
Application.CutCopyMode = False
Selection.Clear
Range("A7").Select
End Seleect
Nextwscl
End Sub
RegardsJorgen