most
Board Regular
- Joined
- Feb 22, 2011
- Messages
- 106
- Office Version
- 365
- 2019
- Platform
- Windows
- Mobile
How to combine IsError with Left if a cell contains more than 255 characters?
This example works fine as long as no cell has more than 255 characters, if it's more than 255, IsError => run-time error.
And doing left och len on a cell with error won't compute.
This example works fine as long as no cell has more than 255 characters, if it's more than 255, IsError => run-time error.
VBA Code:
For C = 10 To 13
If Application.WorksheetFunction.IsError(Cells(2, C)) Then
Debug.Print ("N/A or ERROR")
Else
Debug.Print Left(Cells(2, C).value, 25)
End If
Next C
And doing left och len on a cell with error won't compute.