Brutality
New Member
- Joined
- Feb 5, 2003
- Messages
- 44
Hi there,
I have the following code working but am wondering if is the safest approach. Obviously all it is doing is clearing the desired selection on the specified worksheets.
*****************
Sub ClearRunSheets()
Dim CodeNameArr, CodNam
Dim ws As Worksheet
CodeNameArr = Array("sShortRun", "sLongRun", "sMedRun", "sNARun")
With ActiveWorkbook
For Each CodNam In CodeNameArr
Set ws = .Worksheets(CStr(.VBProject.VBComponents(CodNam).Properties("Name")))
ws.Range("A2:Z1000") = ""
Next CodNam
End With
End Sub
*****************
I know I could use:
ws.Select
Range("A1:Z1000")
Selection.ClearContents
instead of the single line
ws.Range("A2:Z1000") = ""
to be sure, but setting the cells to empty hasn't given me any problems so far. Is there a reason not to use this approach?
TIA
/*Mark
I have the following code working but am wondering if is the safest approach. Obviously all it is doing is clearing the desired selection on the specified worksheets.
*****************
Sub ClearRunSheets()
Dim CodeNameArr, CodNam
Dim ws As Worksheet
CodeNameArr = Array("sShortRun", "sLongRun", "sMedRun", "sNARun")
With ActiveWorkbook
For Each CodNam In CodeNameArr
Set ws = .Worksheets(CStr(.VBProject.VBComponents(CodNam).Properties("Name")))
ws.Range("A2:Z1000") = ""
Next CodNam
End With
End Sub
*****************
I know I could use:
ws.Select
Range("A1:Z1000")
Selection.ClearContents
instead of the single line
ws.Range("A2:Z1000") = ""
to be sure, but setting the cells to empty hasn't given me any problems so far. Is there a reason not to use this approach?
TIA
/*Mark