Rejje
11-24-2010, 04:38 PM
Hi! Still learning th basics I have got a problem I can't manage a solution by myself but probably is really a piece-of-cake for quite a few who'd read this.
Thing is below functional sub really loops through an area named "EXPORTLIST" and in which are the addresses to other named cells/areas in different worksheets that often need to be erased. However I have had to use regular cell "F37" and then loop from there.
What I would like to see is what a loop in "EXPORTLIST" would look like that keeps on as long as it's in that area.
Anyone?
Area "EXPORTLIST" below
EXP_1010 EXP_1020 EXP_1030 onto EXP_6040
Sub EraseAll()
Dim answer As Integer
Dim row As Integer
answer = MsgBox("Do you really want to erase all data?", vbYesNo)
If answer = 6 Then
Application.ScreenUpdating = False
Application.Calculation = xlManual
row = Worksheets("V").Range("F37").Row
While (Left(Worksheets("V").Range("F" & row).Value, 3) = "EXP")
Range(Worksheets("V").Range("F" & row).Value).Select
Selection.ClearContents
row = row + 1
Wend
Range("A1").Select
Application.ScreenUpdating = True
Application.Calculation = xlCalculationAutomatic
End If
End Sub
Thing is below functional sub really loops through an area named "EXPORTLIST" and in which are the addresses to other named cells/areas in different worksheets that often need to be erased. However I have had to use regular cell "F37" and then loop from there.
What I would like to see is what a loop in "EXPORTLIST" would look like that keeps on as long as it's in that area.
Anyone?
Area "EXPORTLIST" below
EXP_1010 EXP_1020 EXP_1030 onto EXP_6040
Sub EraseAll()
Dim answer As Integer
Dim row As Integer
answer = MsgBox("Do you really want to erase all data?", vbYesNo)
If answer = 6 Then
Application.ScreenUpdating = False
Application.Calculation = xlManual
row = Worksheets("V").Range("F37").Row
While (Left(Worksheets("V").Range("F" & row).Value, 3) = "EXP")
Range(Worksheets("V").Range("F" & row).Value).Select
Selection.ClearContents
row = row + 1
Wend
Range("A1").Select
Application.ScreenUpdating = True
Application.Calculation = xlCalculationAutomatic
End If
End Sub