Like this:
VBA Code:Sub teeest() Dim x As Variant x = InputBox("column?") Range("A1:" & x & "1").Select End Sub
Sub teeest()
Dim x As Variant
x = InputBox("address?")
Range("A1:" & x).Select
End Sub
Sub teeest()
Dim x As Range
On Error Resume Next
Set x = Application.InputBox("Select last cell", Type:=8)
On Error GoTo 0
If Not x Is Nothing Then Range("A1", x).Select
End Sub
now I see that it works, yesterday I tried several times and it didn't work ... I don't know ...If you are just entering in the column letter ("H"), then the first code I posted up in my first reply should work.
If it does not, then please answer the following questions:
1. Are you getting any error messages? If so, what do they say?
2. If there are no error messages, but it just isn't doing what you want, please explain what it is doing?
3. Is column H or row 1 protected?
4. Are any of the cells in the range A1:H1 part of merged cells?
5. Is column H or row 1 hidden?
Sub teeest()
Dim x As Variant
x = InputBox("column?")
Range("A1:" & x & "1").Select
End Sub
You could do something like this?
VBA Code:Sub teeest() Dim x As Range On Error Resume Next Set x = Application.InputBox("Select last cell", Type:=8) On Error GoTo 0 If Not x Is Nothing Then Range("A1", x).Select End Sub