Hi Simon
Firstly, don't let the user type anything, as 9 times out of ten they get it wrong and then blame you. Use a Listbox Control on a UserForm and populate it like this:
Private Sub UserForm_Initialize()
Dim wSht As Worksheet
For Each wSht In ActiveWorkbook.Worksheets
ListBox1.AddItem (wSht.Name)
Next wSht
End Sub
Next add some OptionButtons allowing them to choose what to do.
Next declare a variable at the Module level. That is place it at the very top of the UserForm Private Sub, eg;
Dim sChoice As String
Now for each OptionButton some code like this:
Private Sub OptionButton1_Click()
sChoice = "Clear"
End Sub
Private Sub OptionButton2_Click()
sChoice = "RangeAdd"
End Sub
Do this for all your OptionButtons.
Now add a CommandButton and add some code like this:
Private Sub CommandButton1_Click()
Dim sSheetName As String
If ListBox1.ListIndex > -1 And sChoice <> "" Then
sSheetName = ListBox1
Select Case sChoice
Case "Clear"
Sheets(sSheetName).Cells.Clear
Case "RangeAdd"
Sheets(sSheetName).Range("A1:A10") = "#N/A"
End Select
End If
End Sub
That should get you started.
Dave
OzGrid Business Applications