Wednesday 6 July 2016

Troubleshoot:Avoiding an occasional error message

Avoiding an occasional error message

Hi,
I have this macro which works great except the Run-time error when it finds the blank cell in column C.
Here how it works, column C contained the list of full-names (some with middle initial).
Column A and B are the blank columns to receive data of
first and last name from the column C.
It inserts comas if the letters are less than four characters long and also turns the text of column A and B into sentence case and column C in capital letters.
It really doing its job but the only thing that I didn’t
like is that when it finds any blank cell in column C an windows pop up with Run time error ‘13’ Type mismatch.
I can live with it by clicking End but it would be nice if it terminate peacefully (without any message) and without filling #Value! In column A
and B’s rows.
The blank cell appears in column C because the sheet have three hundred rows and the names-list is sometimes less than a three hundred in row so whatever cell lefts blank in column C that’s when error window appears.
Any help in this regard will
be greatly appreciated. No shortcuts or hints please, I am not an expert.
Thanks
 
Option Explicit
Sub Names()
Range("A2:A" & Cells(Rows.Count, "C").End(xlUp).Row).Formula = _
"=LEFT(C2,FIND("" "",C2)-1)"
Range("B2:B" & Cells(Rows.Count, "C").End(xlUp).Row).Formula = _
"=IFERROR(MID(C2,FIND("" "",C2,FIND("" "",C2)+1)+1,20),MID(C2,FIND("" "",C2)+1,20))"
Dim cll As Range
For Each cll In Intersect(ActiveSheet.UsedRange, Columns("A:B"))
If Len(cll.Value) < 4 And cll.Value <> "" _
Then cll.Value = Left(cll.Value & ",,,,", 4)
cll.Value = UCase(Left(cll.Value, 1)) & LCase(Mid(cll.Value, 2, 255))
Next cll
For Each cll In Intersect(ActiveSheet.UsedRange, Columns("C:C"))
cll.Value = UCase(cll.Value)
Next cll
End Sub

Anwsers to the Problem Avoiding an occasional error message

Download SmartPCFixer for Free Now

Does this code do what you want?
Sub Names()
  Dim cll As Range
  Range("A2:A" & Cells(Rows.Count, "C").End(xlUp).Row).Formula = _
                            "=LEFT(C2,FIND("" "",C2&"" "")-1)"
  Range("B2:B" & Cells(Rows.Count, "C").End(xlUp).Row).Formula = _
        "=IF(LEN(C2)>LEN(SUBSTITUTE(C2,"" "","""")),TRIM(" & _
        "RIGHT(SUBSTITUTE(C2,"" "",REPT("" "",99)),99)),"""")"
  For Each cll In Intersect(ActiveSheet.UsedRange, Columns("A:B"))
    If Len(cll.Value) < 4 And cll.Value <> "" Then _
           cll.Value = Left(cll.Value & ",,,,", 4)
    cll.Value = UCase(Left(cll.Value, 1)) & LCase(Mid(cll.Value, 2, 255))
  Next cll
  For Each cll In Intersect(ActiveSheet.UsedRange, Columns("C:C"))
    cll.Value = UCase(cll.Value)
  Next cll
End Sub

Boot in Safe Mode:

  • Open Run command as previously described
  • Type MSConfig
  • Click on Boot tab
  • Tick Safe boot in Boot option
  • Select Network
  • Click Apply and OK
  • Reboot your system

Your system will boot in Safe mode with Networking. You may now try and open Windows Store and should not see any errors.

Recommended Method to Repair the Problem: Avoiding an occasional error message:

How to Fix Avoiding an occasional error message with SmartPCFixer?

1. Download Error Fixer. Install it on your computer.

2. After the scan is done, you can see the errors and problems which need to be fixed.

3. When the Fixing part is done, your computer has been speeded up and the errors have been removed


Related: AMD Radeon HD 7800M Win8 not working [Anwsered],I can access the internet, get on facebook and get to hotmail, but I can't play games on facebook and I can't open or respond to my e-mails,I keep getting this Media Player error when I log on my computer. [Anwsered],[Anwsered] System Hanging on shutdown and restart,Unable to get the Vlookup property of the WorksheetFunction class,Solution to Error: Error: "0x81000032 make sure the C: drive is online and set to NTFS" when trying to backup to external hard drive.
,Troubleshoot:External Hard Drive not listed in Windows 7 backup wizard Error
,I'm always being signed off so annoying Tech Support
,Solution to Problem: Impossible to use Internet Explorer! I keep getting the same error message every time i try to use IE.
,Solution to Problem: Referencing data in another file
,Troubleshoot:Error: "0x81000032 make sure the C: drive is online and set to NTFS" when trying to backup to external hard drive. Error,External Hard Drive not listed in Windows 7 backup wizard Tech Support,Tech Support: I'm always being signed off so annoying,Solution to Problem: Impossible to use Internet Explorer! I keep getting the same error message every time i try to use IE.,Referencing data in Access using Excel [Anwsered],Need Best Way To Present Data [Anwsered],Same question but for windows 7 home edition,sometimes fullscreen won't activate [Solved],Solution to Error: We bought a new computer with windows 7 and it is constantly freezing. How do we fix this?,Solution to Error: Windows 8 update crash (2013-07-22)
Read More: Troubleshoot:Automatic update continues to prompt when no update needed,[Solved] Attempting to upgrade to IE 8 and on installation get error msg: the procedure entry point SHRegGetValueW could not be located in dynamic link library SHLWAPI.dll. What to do next?,Solution to Problem: Backing Up Moving files used daily from one folder to another,Troubleshooting:Backup and\/or formatting dvds causes drive to go into a loop. Need to manually eject to stop it. Error,Solution to Error: Backup and Restore fails to back up to a network location.Error: 0x8078012D',application not found error,any problems in a team where one has Windows XP and the other has Windows 7?,Application/Object-Defined Error,An Excel formula question where hours are totalled and cumulating,Anyone know the hardware email?

No comments:

Post a Comment