Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.misc
|
|||
|
|||
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
Posted to microsoft.public.excel.misc
|
|||
|
|||
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
Posted to microsoft.public.excel.misc
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
My excel macro recorder no longer shows up when recording macro | Excel Discussion (Misc queries) | |||
My excel macro recorder no longer shows up when recording macro | Excel Discussion (Misc queries) | |||
using a cell value to control a counter inside a macro and displaying macro value | Excel Worksheet Functions | |||
Macro needed to Paste Values and prevent Macro operation | Excel Discussion (Misc queries) | |||
Macro needed to Paste Values and prevent Macro operation | Excel Discussion (Misc queries) |