#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Len()

From earlier question, here's what I'm trying to do: the Len() functio
doesn't appear to work. I'm capturing user input via an InputBox, an
testing it to see if it's 6 digits in length. If it isn't, anothe
function will be called. However if it is 6 digits in length, th
function should insert the user input 6-digit value into the rang
"TA". Here again is the code. Any input about why the len() featur
isn't working here would be great (I tested it by entering 6 digit #'
and it calls the other function as if it were <6. see variable title
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 yo
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 int
that cell if it is 6 digits in length


End I

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

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,885
Default Len()

Hi
see you older post. Problem is the set statement

--
Regards
Frank Kabel
Frankfurt, Germany


From earlier question, here's what I'm trying to do: 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/


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 71
Default Len()

See responses to earlier post

"Tracey " wrote in message
...
From earlier question, here's what I'm trying to do: 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/



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 770
Default Len()

Tracey,

It also looks like the line:
newnumrng = ActiveCell.Value
should be:
ActiveCell.Value = newnumrng

The way it is now you are assigning the Activecell value to newnum, but your
comment says the opposite.

hth,

Doug

"Tracey " wrote in message
...
From earlier question, here's what I'm trying to do: 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/



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 07:11 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"