Thread: 400 Error
View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Brett Brett is offline
external usenet poster
 
Posts: 113
Default 400 Error

Bit of basic code but i cannot clear the contents of the range because they
won't select with the current code i have.

Sub Button19_Click()

Dim name As String
Dim pswd As String

name = Sheet1.TextBox1.Value
pswd = Sheet1.TextBox2.Value

If pswd = "Alphabet" Then
Sheets("Record").Visible = True

Sheets("Times tables").Select
Range("G3:G12").Select
Selection.ClearContents
Range("E1").Select

Sheet1.TextBox1.Value = ""
Sheet1.TextBox2.Value = ""


Else
ActiveWorkbook.Close
Application.Quit

End If

End Sub

I wanted to focus on using the code

Sheets("Times tables").Select
Range("G3:G12").Select
Selection.ClearContents
Range("E1").Select

For my project, however, i get a 400 error and my code does not work. If i
remove the following:

Range("G3:G12").Select
Selection.ClearContents
Range("E1").Select

The code seems fine and the Times tables page is selected, but i cannot
select cells.

Any help is much appreciated.