#1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35
Default Using LEN in a macro

I have an IF statement in my macro that uses LEN() to test if a cell has more
than 250 characters. If the cell has more than 250 characters, the IF steps
take place. Otherwise they don't and the macro continues.

However, the problem I'm encountering is that if the cell has less than 10
characters in it, my test doesn't work and the IF steps take place when they
shouldn't. Any thoughts? The IF statement is as follows:

MyCell = ActiveCell
If ActiveCell.Value < "[Client Receives]" And Len(MyCell) "250" Then
Selection.Copy
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
End If

Thanks for your help.
Ellen
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 10,593
Default Using LEN in a macro

len is numeric

MyCell = ActiveCell
If ActiveCell.Value < "[Client Receives]" And Len(MyCell) 250 Then
Selection.Copy
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
End If


--
---
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)



"Ellen G" wrote in message
...
I have an IF statement in my macro that uses LEN() to test if a cell has
more
than 250 characters. If the cell has more than 250 characters, the IF
steps
take place. Otherwise they don't and the macro continues.

However, the problem I'm encountering is that if the cell has less than 10
characters in it, my test doesn't work and the IF steps take place when
they
shouldn't. Any thoughts? The IF statement is as follows:

MyCell = ActiveCell
If ActiveCell.Value < "[Client Receives]" And Len(MyCell) "250" Then
Selection.Copy
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
End If

Thanks for your help.
Ellen



  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35
Default Using LEN in a macro

OF COURSE!!! Silly me. Thanks so much.

Ellen

"Bob Phillips" wrote:

len is numeric

MyCell = ActiveCell
If ActiveCell.Value < "[Client Receives]" And Len(MyCell) 250 Then
Selection.Copy
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
End If


--
---
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)



"Ellen G" wrote in message
...
I have an IF statement in my macro that uses LEN() to test if a cell has
more
than 250 characters. If the cell has more than 250 characters, the IF
steps
take place. Otherwise they don't and the macro continues.

However, the problem I'm encountering is that if the cell has less than 10
characters in it, my test doesn't work and the IF steps take place when
they
shouldn't. Any thoughts? The IF statement is as follows:

MyCell = ActiveCell
If ActiveCell.Value < "[Client Receives]" And Len(MyCell) "250" Then
Selection.Copy
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
End If

Thanks for your help.
Ellen




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


Similar Threads
Thread Thread Starter Forum Replies Last Post
My excel macro recorder no longer shows up when recording macro jack Excel Discussion (Misc queries) 1 February 5th 07 09:31 PM
My excel macro recorder no longer shows up when recording macro jack Excel Discussion (Misc queries) 3 February 5th 07 08:22 PM
using a cell value to control a counter inside a macro and displaying macro value ocset Excel Worksheet Functions 1 September 10th 06 05:32 AM
Macro needed to Paste Values and prevent Macro operation thunderfoot Excel Discussion (Misc queries) 1 June 11th 05 12:44 AM
Macro needed to Paste Values and prevent Macro operation thunderfoot Excel Discussion (Misc queries) 0 June 10th 05 03:38 PM


All times are GMT +1. The time now is 11:47 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"