View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Bob Kilmer[_2_] Bob Kilmer[_2_] is offline
external usenet poster
 
Posts: 71
Default Beginner asking for advice

Replace "Set" with "Let" (or nothing at all). Set is used to assign object
references only. InputBox only returns an object when Type = 8, but using by
Set, you are forcing to be an object.

"Tracey " wrote in message
...
Ok, here's what I'm trying to do: I got the code to work but the Len()
function doesn't appear to work. I'm capturing user input via an
InputBox, and testing it to see if it's 6 digits in length. If it
isn't, another function will be called. However if it is 6 digits in
length, the function should insert the user input 6-digit value into
the range "TA". Here again is the code. Any input about why the len()
feature isn't working here would be great (I tested it by entering 6
digit #'s and it calls the other function as if it were <6. see
variable titled digits for this value.

Function manual_ta()

Dim newnumrng As Range 'user input
Dim digits As Integer 'digits used for capturing length of user entry

On Error Resume Next
Set newnumrng = Application.inputbox(prompt:="What number would you
like to assign to this TA? Click OK after entering number.", Type:=1)

digits = Len(newnumrng)
If digits < 6 Then
Call question
Else

Range("TA").ClearContents 'clear the old TA #
newnumrng = ActiveCell.Value 'paste the value of the user input into
that cell if it is 6 digits in length


End If


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