انتقل إلى المحتوى الرئيسي

كيف تغمق كل الكلمات المحددة في نطاق من الخلايا؟

doc غامق نص محدد 1

في Excel ، فإن ملف بحث واستبدال يمكن أن تساعدنا الوظيفة في العثور على أي نص محدد وإعطاء تنسيق غامق أو أي تنسيق آخر للخلايا بأكملها. ولكن ، هل سبق لك أن حاولت جعل النص المحدد في الخلايا غامقًا فقط وليس الخلية بأكملها كما هو موضح أدناه:

غامق كل الكلمات المحددة في نطاق من الخلايا برمز VBA


السهم الأزرق الحق فقاعة غامق كل الكلمات المحددة في نطاق من الخلايا برمز VBA

قد تساعدك التعليمات البرمجية لـ VBA التالية على جعل النص المحدد في محتوى الخلية غامقًا فقط ، يرجى القيام بما يلي:

1. اضغط باستمرار على ALT + F11 مفاتيح لفتح ميكروسوفت فيسوال باسيك للتطبيقات نافذة.

2. انقر إدراج > وحدة، والصق الكود التالي في ملف وحدة نافذة او شباك.

رمز فبا: نص غامق محدد في نطاق من الخلايا

Sub FindAndBold()
'Updateby Extendoffice 20160711
    Dim xFind As String
    Dim xCell As Range
    Dim xTxtRg As Range
    Dim xCount As Long
    Dim xLen As Integer
    Dim xStart As Integer
    Dim xRg As Range
    Dim xTxt As String
    On Error Resume Next
    If ActiveWindow.RangeSelection.Count > 1 Then
      xTxt = ActiveWindow.RangeSelection.AddressLocal
    Else
      xTxt = ActiveSheet.UsedRange.AddressLocal
    End If
    Set xRg = Application.InputBox("Please select data range:", "Kutools for Excel", xTxt, , , , , 8)
    If xRg Is Nothing Then Exit Sub
    On Error Resume Next
    Set xTxtRg = Application.Intersect(xRg.SpecialCells(xlCellTypeConstants, xlTextValues), xRg)
    If xTxtRg Is Nothing Then
        MsgBox "There are no cells with text"
        Exit Sub
    End If
    xFind = Trim(Application.InputBox("What do you want to BOLD?", "Kutools for Excel", , , , , , 2))
    If xFind = "" Then
        MsgBox "No text was listed", vbInformation, "Kutools for Excel"
        Exit Sub
    End If
    xLen = Len(xFind)
    For Each xCell In xTxtRg
        xStart = InStr(xCell.Value, xFind)
        Do While xStart > 0
            xCell.Characters(xStart, xLen).Font.Bold = True
            xCount = xCount + 1
            xStart = InStr(xStart + xLen, xCell.Value, xFind)
        Loop
    Next
    If xCount > 0 Then
        MsgBox "number of " & CStr(xCount) & " text be bolded!", vbInformation, "Kutools for Excel"
    Else
        MsgBox "Not find the specific text!", vbInformation, "Kutools for Excel"
    End If
End Sub

3. ثم اضغط F5 مفتاح لتشغيل هذا الرمز ، ويظهر مربع موجه لتذكيرك بتحديد نطاق البيانات الذي تريد أن تجعله غامقًا ، انظر لقطة الشاشة:

doc غامق نص محدد 2

4. ثم انقر فوق OK، سيظهر مربع آخر لتذكيرك بإدخال النص المحدد الذي تريد كتابته بخط غامق فقط في الخلايا ، انظر لقطة الشاشة:

doc غامق نص محدد 3

5. بعد إدخال النص ، الرجاء الضغط OK ، وجميع النص الذي حددته غامق في النطاق المحدد ، انظر الصورة:

doc غامق نص محدد 4

أفضل أدوات إنتاجية المكتب

🤖 مساعد Kutools AI: إحداث ثورة في تحليل البيانات على أساس: التنفيذ الذكي   |  إنشاء التعليمات البرمجية  |  إنشاء صيغ مخصصة  |  تحليل البيانات وإنشاء الرسوم البيانية  |  استدعاء وظائف Kutools...
الميزات الشعبية: البحث عن التكرارات أو تمييزها أو تحديدها   |  حذف الصفوف الفارغة   |  دمج الأعمدة أو الخلايا دون فقدان البيانات   |   جولة بدون صيغة 
سوبر بحث: معايير متعددة VLookup    VLookup ذات القيمة المتعددة  |   VLookup عبر أوراق متعددة   |   بحث غامض ....
قائمة منسدلة متقدمة: إنشاء القائمة المنسدلة بسرعة   |  القائمة المنسدلة التابعة   |  قائمة منسدلة متعددة التحديد ....
مدير العمود: إضافة عدد محدد من الأعمدة  |  نقل الأعمدة  |  تبديل حالة رؤية الأعمدة المخفية  |  مقارنة النطاقات والأعمدة 
الميزات المميزة: التركيز على الشبكة   |  عرض تصميم   |   شريط الفورمولا الكبير    مدير المصنفات والأوراق   |  مكتبة الموارد (النص السيارات)   |  منتقي التاريخ   |  اجمع أوراق العمل   |  تشفير/فك تشفير الخلايا    إرسال رسائل البريد الإلكتروني عن طريق القائمة   |  سوبر تصفية   |   مرشح خاص (تصفية غامق / مائل / يتوسطه خط ...) ...
أفضل 15 مجموعة أدوات12 نص الأدوات (إضافة نص, إزالة الأحرف، ...)   |   +50 رسم الأنواع (مخطط جانت، ...)   |   40+ عملي الصيغ (احسب العمر على أساس تاريخ الميلاد، ...)   |   19 إدخال الأدوات (أدخل رمز الاستجابة السريعة, إدراج صورة من المسار، ...)   |   12 تحويل الأدوات (أرقام إلى كلمات, نتيجة تحويل عملة، ...)   |   7 دمج وتقسيم الأدوات (الجمع بين الصفوف المتقدمة, تقسيم الخلايا، ...)   |   ... و اكثر

عزز مهاراتك في Excel باستخدام Kutools for Excel، واختبر كفاءة لم يسبق لها مثيل. يقدم Kutools for Excel أكثر من 300 ميزة متقدمة لتعزيز الإنتاجية وتوفير الوقت.  انقر هنا للحصول على الميزة التي تحتاجها أكثر...

الوصف


يجلب Office Tab الواجهة المبوبة إلى Office ، ويجعل عملك أسهل بكثير

  • تمكين التحرير والقراءة المبوبة في Word و Excel و PowerPointوالناشر والوصول و Visio والمشروع.
  • فتح وإنشاء مستندات متعددة في علامات تبويب جديدة من نفس النافذة ، بدلاً من النوافذ الجديدة.
  • يزيد من إنتاجيتك بنسبة 50٪ ، ويقلل مئات النقرات بالماوس كل يوم!
Comments (10)
Rated 5 out of 5 · 1 ratings
This comment was minimized by the moderator on the site
Worked perfectly fine for me. I track leases and the documents that need to be submitted by agents. I put "none" in the cells for the leases that have had all docs turned in. Bolding the words makes it easier to read!

Thanks again for the help!
Rated 5 out of 5
This comment was minimized by the moderator on the site
Awesome! Worked great!
This comment was minimized by the moderator on the site
I get the first pop up hit ok but then don't get the second pop up window to type in the word?
This comment was minimized by the moderator on the site
I attempted to run this code and just got an error..."Compile Error: Wrong # of arguments or invalid property assignment". Below is the image of the error message and the breakpoint of the code.
This comment was minimized by the moderator on the site
Hello, Sherry,
I can not see your screenshot, please upload it again.
Thank you!
This comment was minimized by the moderator on the site
Hello, its possible to search multiple text and bold that text PLUS that cell line. (I have 1 cell with 5 lines, i want to bold the line if find "1º", if rest like "2º" "3º" , "number + º " bold only number.)

Other need is:
If find "1º" bold that cell line
This comment was minimized by the moderator on the site
Can this VBA be modified to bold multiple texts, such as "KTE", "KTO", and "KTW"?
This comment was minimized by the moderator on the site
Hello, Eric,

May be the following VBA code can help you to bold multiple specific cell, please apply the below code.
Sub FindAndBold()
Dim I As Long
Dim xFind As String
Dim xCell As Range
Dim xTxtRg As Range
Dim xCount As Long
Dim xLen As Integer
Dim xStart As Integer
Dim xRg As Range, xRgFind As Range
Dim xTxt As String
Dim xArr() As String
On Error Resume Next
If ActiveWindow.RangeSelection.Count > 1 Then
xTxt = ActiveWindow.RangeSelection.AddressLocal
Else
xTxt = ActiveSheet.UsedRange.AddressLocal
End If
Set xRg = Application.InputBox("Please select data range:", "Kutools for Excel", xTxt, , , , , 8)
If xRg Is Nothing Then Exit Sub
On Error Resume Next
Set xTxtRg = Application.Intersect(xRg.SpecialCells(xlCellTypeConstants, xlTextValues), xRg)
If xTxtRg Is Nothing Then
MsgBox "There are no cells with text"
Exit Sub
End If
Set xRgFind = Application.InputBox("Select the text cells you want to bold", "Kutools for Excel", , , , , , 8)
If xRgFind Is Nothing Then
MsgBox "No text was listed", vbInformation, "Kutools for Excel"
Exit Sub
End If
ReDim xArr(xRgFind.Count - 1)
For I = 0 To (xRgFind.Count - 1)
xArr(I) = xRgFind(I + 1)
Next
For Each xCell In xTxtRg
For I = 0 To UBound(xArr)
xFind = Trim(xArr(I))
xStart = InStr(xCell.Value, xFind)
xLen = Len(xFind)
Do While xStart > 0
xCell.Characters(xStart, xLen).Font.Bold = True
xCount = xCount + 1
xStart = InStr(xStart + xLen, xCell.Value, xFind)
Loop
Next
Next
If xCount > 0 Then
MsgBox "number of " & CStr(xCount) & " text be bolded!", vbInformation, "Kutools for Excel"
Else
MsgBox "Not find the specific text!", vbInformation, "Kutools for Excel"
End If
End Sub

Hope it can help you, thank you!
This comment was minimized by the moderator on the site
Hello skyyang, can you help me out in my excel?
If find "1º" in a cell with several lines, bold that cell line
This comment was minimized by the moderator on the site
if I want to make bold the string G-AD only it doesn t work if i have in my cell G-AD and G-AD-bla-bla-bla (this G-AD should not be made BOLD)
There are no comments posted here yet
Please leave your comments in English
Posting as Guest
×
Rate this post:
0   Characters
Suggested Locations