Re: IsBlank or 6 digits required
Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance
"Ron" <whasupwityou@xxxxxxxxxxx> wrote:
How would I edit this line to allow only
a blank cell or 6 digits.
If Len(Range("a1")(i, col).Value) <> 6 Then
Depends on what you mean by "blank cell": empty, or empty or a null string
(""). One of the following might work for you:
If Range("a1")(i,col) = "" or Len(Range("a1")(i,col)) = 6 Then
If IsEmpty(Range("a1")(i,col)) Or Len(Range("a1")(i,col)) = 6 Then
Note-1: You said "allow ... 6 digits". That is why I changed "<> 6" to "=
6". If "<> 6" is "allow" in your parlance, then I don't know quite what you
mean by "allow a blank cell". You might need to reverse the above logic
using "Not IsEmpty(...)".
Note-2: If by "blank cell", you also want to allow for a string of spaces
(e.g. " "), you can use Trim(Range("a1")(i,col)) in the first solution.
.
Relevant Pages
- Re: Text formatted cells displaying numbers in scientific format
... When it 'sees' a large number it uses scientific format since ... I accept that Excel can't handle numbers greater than 15 digits and your ... string was 16 digits or more to be converted to a scientific value. ... It just doesn't display correctly in the cell (except after entering ... (microsoft.public.excel) - Re: Text formatted cells displaying numbers in scientific format
... I accept that Excel can't handle numbers greater than 15 digits and your ... I'd expect any 'numbers only' numeric string to be treated as a numeric ... Adding a single quote makes Excel ... just doesn't display correctly in the cell (except after entering editing ... (microsoft.public.excel) - Re: Hexadecimal Numbers
... I misunderstood the 4 characters from that set of 16. ... I'm only saving four digits in each of these cells so the 16 ... and more local to the cell. ... character string in the cells of one column in the spreadsheet. ... (microsoft.public.excel.programming) - Re: Find a Cell Value
... this will return the first four digits of your value... ... get the offset of one but the number value in the cell looks like this ... Dim myString As String, c As Range ... (microsoft.public.excel.programming) - Re: Text formatted cells displaying numbers in scientific format
... they are just strings of digits and as such they might as well be treated as ... Adding a single quote makes Excel ... but then just going to edit the cell fixes the problem without ... Or arrange to have a single quote in front of the long string of digits ... (microsoft.public.excel) |
|