View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Andoni[_36_] Andoni[_36_] is offline
external usenet poster
 
Posts: 1
Default Newbie Macro Query - Clearing Variables and Assigning a Variable

1)One easy way:

X=""
once you have used the variable named X

2)
Sub TryThis()
Dim Sht As Worksheet
Dim X As String 'the name of the sheet
'Worksheets("Budget").Activate
X = Range("S4")
'Lcase avoids upper lower... case problems
For Each Sht In ThisWorkbook.Worksheets
If LCase(Sht.Name) = LCase(X) Then
Sht.Activate
Exit For
End If
Next Sht

End Su

--
Message posted from http://www.ExcelForum.com