ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Error message is Character Limit is over 1024 characters (https://www.excelbanter.com/excel-discussion-misc-queries/218497-error-message-character-limit-over-1024-characters.html)

Vick

Error message is Character Limit is over 1024 characters
 
What I'm trying to do is have a macro to check the certain merged cells for
character limits. If a merged cell is over 1024 characters, I want it to
display an error message. The error message part is fine, it's displaying how
I want. But I can get the If statement to work right. If there is any
characters in the Merged cell it displays the error. The code I've been
trying is below. Any hints or rewrite would appreciated. Thanks

Range B11:H12 is one merged cell, if that helps at all

Txtcll = 1024
Range("B11:H12").Select
If Len(ActiveCell.Value) Txtcell Then
MsgBox ActiveCell.Address + " Contains too many characters,
please copy some of you text to another line."
Exit Sub
End If

Vick

Barb Reinhardt

Error message is Character Limit is over 1024 characters
 
FWIW, I found this by using Option Explicit before the code. It forces you
to declare all variables.
--
HTH,
Barb Reinhardt

If this post was helpful to you, please click YES below.



"Vick" wrote:

What I'm trying to do is have a macro to check the certain merged cells for
character limits. If a merged cell is over 1024 characters, I want it to
display an error message. The error message part is fine, it's displaying how
I want. But I can get the If statement to work right. If there is any
characters in the Merged cell it displays the error. The code I've been
trying is below. Any hints or rewrite would appreciated. Thanks

Range B11:H12 is one merged cell, if that helps at all

Txtcll = 1024
Range("B11:H12").Select
If Len(ActiveCell.Value) Txtcell Then
MsgBox ActiveCell.Address + " Contains too many characters,
please copy some of you text to another line."
Exit Sub
End If

Vick


Barb Reinhardt

Error message is Character Limit is over 1024 characters
 
You have TxtCll in one place and TxtCell in another???
--
HTH,
Barb Reinhardt

If this post was helpful to you, please click YES below.



"Vick" wrote:

What I'm trying to do is have a macro to check the certain merged cells for
character limits. If a merged cell is over 1024 characters, I want it to
display an error message. The error message part is fine, it's displaying how
I want. But I can get the If statement to work right. If there is any
characters in the Merged cell it displays the error. The code I've been
trying is below. Any hints or rewrite would appreciated. Thanks

Range B11:H12 is one merged cell, if that helps at all

Txtcll = 1024
Range("B11:H12").Select
If Len(ActiveCell.Value) Txtcell Then
MsgBox ActiveCell.Address + " Contains too many characters,
please copy some of you text to another line."
Exit Sub
End If

Vick



All times are GMT +1. The time now is 09:27 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com