## UnBreakAr + BreakAr

Fix broken Arabic char, by using AscW and ChrW
This is Excel User-defined function UDF
Can also be used as encryption

Function UnBreakAr(BrokenArabic As Range)
Dim Ara(1 To 48)
Dim Bro(1 To 48)
Ara(1) = 1548: Bro(1) = 161 ' AscW of Arabic : AscW of broken
Ara(2) = 1563: Bro(2) = 186
Ara(3) = 1567: Bro(3) = 191
Ara(4) = 1569: Bro(4) = 193
Ara(5) = 1570: Bro(5) = 194
Ara(6) = 1571: Bro(6) = 195
Ara(7) = 1572: Bro(7) = 196
Ara(8) = 1573: Bro(8) = 197
Ara(9) = 1574: Bro(9) = 198
Ara(10) = 1575: Bro(10) = 199
Ara(11) = 1576: Bro(11) = 200
Ara(12) = 1577: Bro(12) = 201
Ara(13) = 1578: Bro(13) = 202
Ara(14) = 1579: Bro(14) = 203
Ara(15) = 1580: Bro(15) = 204
Ara(16) = 1581: Bro(16) = 205
Ara(17) = 1582: Bro(17) = 206
Ara(18) = 1583: Bro(18) = 207
Ara(19) = 1584: Bro(19) = 208
Ara(20) = 1585: Bro(20) = 209
Ara(21) = 1586: Bro(21) = 210
Ara(22) = 1587: Bro(22) = 211
Ara(23) = 1588: Bro(23) = 212
Ara(24) = 1589: Bro(24) = 213
Ara(25) = 1590: Bro(25) = 214
Ara(26) = 1591: Bro(26) = 216
Ara(27) = 1592: Bro(27) = 217
Ara(28) = 1593: Bro(28) = 218
Ara(29) = 1594: Bro(29) = 219
Ara(30) = 1600: Bro(30) = 220
Ara(31) = 1601: Bro(31) = 221
Ara(32) = 1602: Bro(32) = 222
Ara(33) = 1603: Bro(33) = 223
Ara(34) = 1604: Bro(34) = 225
Ara(35) = 1605: Bro(35) = 227
Ara(36) = 1606: Bro(36) = 228
Ara(37) = 1607: Bro(37) = 229
Ara(38) = 1608: Bro(38) = 230
Ara(39) = 1609: Bro(39) = 236
Ara(40) = 1610: Bro(40) = 237
Ara(41) = 1611: Bro(41) = 240
Ara(42) = 1612: Bro(42) = 241
Ara(43) = 1613: Bro(43) = 242
Ara(44) = 1614: Bro(44) = 243
Ara(45) = 1615: Bro(45) = 245
Ara(46) = 1616: Bro(46) = 246
Ara(47) = 1617: Bro(47) = 248
Ara(48) = 1618: Bro(48) = 250
Tran = ""
For i = 1 To Len(BrokenArabic.Value)
Mi1 = Mid(BrokenArabic.Value, i, 1)
NCh = Mi1
For J = 1 To 48
Ch1 = Bro(J) 'Sheet2.Range("D4").Offset(X1, 1).Value
Ar1 = Ara(J) 'Sheet2.Range("B4").Offset(X1, 1).Value
If Ch1 = AscW(Mi1) Then
NCh = ChrW(Ar1)
Exit For
End If
Next
Tran = Tran & NCh
Next
UnBreakAr = Tran
End Function

Function BreakAr(Arabic As Range)
Dim Ara(1 To 48)
Dim Bro(1 To 48)
Ara(1) = 1548: Bro(1) = 161 ' AscW of Arabic : AscW of broken
Ara(2) = 1563: Bro(2) = 186
Ara(3) = 1567: Bro(3) = 191
Ara(4) = 1569: Bro(4) = 193
Ara(5) = 1570: Bro(5) = 194
Ara(6) = 1571: Bro(6) = 195
Ara(7) = 1572: Bro(7) = 196
Ara(8) = 1573: Bro(8) = 197
Ara(9) = 1574: Bro(9) = 198
Ara(10) = 1575: Bro(10) = 199
Ara(11) = 1576: Bro(11) = 200
Ara(12) = 1577: Bro(12) = 201
Ara(13) = 1578: Bro(13) = 202
Ara(14) = 1579: Bro(14) = 203
Ara(15) = 1580: Bro(15) = 204
Ara(16) = 1581: Bro(16) = 205
Ara(17) = 1582: Bro(17) = 206
Ara(18) = 1583: Bro(18) = 207
Ara(19) = 1584: Bro(19) = 208
Ara(20) = 1585: Bro(20) = 209
Ara(21) = 1586: Bro(21) = 210
Ara(22) = 1587: Bro(22) = 211
Ara(23) = 1588: Bro(23) = 212
Ara(24) = 1589: Bro(24) = 213
Ara(25) = 1590: Bro(25) = 214
Ara(26) = 1591: Bro(26) = 216
Ara(27) = 1592: Bro(27) = 217
Ara(28) = 1593: Bro(28) = 218
Ara(29) = 1594: Bro(29) = 219
Ara(30) = 1600: Bro(30) = 220
Ara(31) = 1601: Bro(31) = 221
Ara(32) = 1602: Bro(32) = 222
Ara(33) = 1603: Bro(33) = 223
Ara(34) = 1604: Bro(34) = 225
Ara(35) = 1605: Bro(35) = 227
Ara(36) = 1606: Bro(36) = 228
Ara(37) = 1607: Bro(37) = 229
Ara(38) = 1608: Bro(38) = 230
Ara(39) = 1609: Bro(39) = 236
Ara(40) = 1610: Bro(40) = 237
Ara(41) = 1611: Bro(41) = 240
Ara(42) = 1612: Bro(42) = 241
Ara(43) = 1613: Bro(43) = 242
Ara(44) = 1614: Bro(44) = 243
Ara(45) = 1615: Bro(45) = 245
Ara(46) = 1616: Bro(46) = 246
Ara(47) = 1617: Bro(47) = 248
Ara(48) = 1618: Bro(48) = 250
Tran = ""
For i = 1 To Len(Arabic.Value)
Mi1 = Mid(Arabic.Value, i, 1)
NCh = Mi1
For J = 1 To 48
Ar1 = Ara(J) 'Sheet2.Range("B4").Offset(X1, 1).Value
Ch1 = Bro(J) 'Sheet2.Range("D4").Offset(X1, 1).Value
If Ar1 = AscW(Mi1) Then
NCh = ChrW(Ch1)
Exit For
End If
Next
Tran = Tran & NCh
Next
BreakAr = Tran
End Function
BrokenArabic
or
Arabic