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

كيفية تمييز الخلية النشطة أو التحديد في Excel؟

إذا كانت لديك ورقة عمل كبيرة ، فقد يصعب عليك اكتشاف الخلية النشطة أو التحديد النشط في لمحة. ولكن ، إذا كان للخلية / القسم النشط لون مميز ، فلن تكون هناك مشكلة لمعرفة ذلك. في هذه المقالة ، سأتحدث عن كيفية تمييز الخلية النشطة أو نطاق الخلايا المحدد تلقائيًا في Excel.

قم بتمييز الخلية النشطة أو التحديد باستخدام رمز VBA


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

يمكن أن يساعدك رمز VBA التالي في تمييز الخلية النشطة أو التحديد بشكل ديناميكي ، يرجى القيام بما يلي:

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

2. ثم اختر ThisWorkbook من اليسار مستكشف المشروع، انقر فوقه نقرًا مزدوجًا لفتح ملف وحدة، ثم انسخ والصق رمز فبا التالي في الوحدة النمطية الفارغة:

كود فبا: قم بتمييز الخلية النشطة أو التحديد

Sub Workbook_SheetSelectionChange(ByVal Sh As Object, ByVal Target As Excel.Range)
'Update 20140923
Static xLastRng As Range
On Error Resume Next
Target.Interior.ColorIndex = 6
xLastRng.Interior.ColorIndex = xlColorIndexNone
Set xLastRng = Target
End Sub

doc- تسليط الضوء على الخلية النشطة 1

3. ثم احفظ هذا الرمز وأغلقه ، ثم عد إلى ورقة العمل ، الآن ، عندما تحدد خلية أو تحديدًا ، سيتم تمييز الخلايا المحددة ، وسيتم نقلها ديناميكيًا مع تغير الخلايا المحددة.

الملاحظات:

1. إذا لم تتمكن من العثور على ملف جزء مستكشف المشروع في النافذة ، يمكنك النقر فوق المزيد > مستكشف المشروع في ال نافذة ميكروسوفت فيسوال باسيك للتطبيقات لفتحه.

2. في الكود أعلاه ، يمكنك التغيير .ColorIndex = شنومكس لون آخر تريده.

3. يمكن تطبيق رمز VBA هذا على جميع أوراق العمل داخل المصنف.

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 (16)
No ratings yet. Be the first to rate!
This comment was minimized by the moderator on the site
I had the same problem, read the whole page and comments. While thinking to apply it or not, I was just randomly clicking on number and letters to select the whole column and rows. Then suddenly highlight of selected cell feature came back :)
This comment was minimized by the moderator on the site
Hello, if someone can help me... I pick up this code in internet (apologies to the owner). It does almost what i need but this code select the entirerow. What i need is a change that alow to select just the first two cells of the row of the activecells. When i click in the cell, i need that the cell of the column "$I16" and "$J16" (16 is the first line of my table) of that row became interior color (=9359529). The code is this: 
Dim lTarget As Range

Private Sub Worksheet_SelectionChange(ByVal Target As Range)

If Target.Row >= 16 Then

If Not lTarget Is Nothing Then

lTarget.EntireRow.Interior.ColorIndex = 0
End If

Target.EntireRow.Interior.Color = 9359529

Set lTarget = Target
End If
End Sub

Can you help me? I had try to change this code but the only thing i can as the select the interior color of the cell target and not the column "$I" and "$J" in that specific row.Thank you for your help.
Luis Lopes
This comment was minimized by the moderator on the site
I know that you proposed a solution but the solution comes with another problem as you described below: "The only problem with having this code active is that you can no longer change the active cell color as it changes back to what it was before you clicked it. I suggest that if you need to change the highlight colors on the sheet, do so with macros disabled or change the sub name for a second so it doesn't trigger when you are clicking on cells". This is not an acceptable alternative for me. I need to be able to change the colors in the cells when the macro is active. Do you have a solution for this this problem. If you come up with a solution for this problem please republish your corrected macro the new macro in full (rather than proposing patches to your original macro because I am technically challenged as far as macro are concerned).
This comment was minimized by the moderator on the site
I tried your macro by copying and pasting it into my Excel file. I did change one thing in the macro though. I changed the color index from 6 to 24 (to a color different than the colors I am currently using in my macro). It worked very nicely and I liked it a lot but then started causing a problem for me. I have a lot of cells filled with with colors in my Excel. The macro started removing the color fill from every cell touched. I don't know how to stop the macro's this odd behavior. I did not have any choice but to remove the macro from my file. I still like to use this macro if someone can help me to fix it.
This comment was minimized by the moderator on the site
That was super helpful, thank you.
This comment was minimized by the moderator on the site
Anyway you can do the left adjacent cell to highlight instead of active cell? Or a range of cells around the activecell?
This comment was minimized by the moderator on the site
Thank you, but use this with caution. It has the undesirable counter effect of not letting undo. Is there any solution for that?
This comment was minimized by the moderator on the site
But i am unable to do undo option and lose the previously assigned cell color also.
Please provide solution
This comment was minimized by the moderator on the site
Perfect solution as I always tend to loose the track of the highlighted cell during "Find and Select" operation. Thanks a lot.
This comment was minimized by the moderator on the site
Great!! But what if I don't want to lose the previously assigned cell color? That would be greater to know.
This comment was minimized by the moderator on the site
Use a conditional format on the cells you want to protect.
This comment was minimized by the moderator on the site
Instead of "ColorIndex" which has a limited set of 255 values (meaning any custom colors are lost), use "Color" instead. You'll need to store the old value in a new static long variable and also generate the highlight color you want with the RGB function. The only problem with having this code active is that you can no longer change the active cell color as it changes back to what it was before you clicked it. I suggest that if you need to change the highlight colors on the sheet, do so with macros disabled or change the sub name for a second so it doesn't trigger when you are clicking on cells, then just rename it back to normal to "re-activate" it. Here is my code:

Sub Workbook_SheetSelectionChange(ByVal Sh As Object, ByVal Target As Excel.Range)

Static xLastRng As Range
Static xLastRngColor As Long

On Error Resume Next

xLastRng.Interior.Color = xLastRngColor
xLastRngColor = Target.Interior.Color
Target.Interior.Color = RGB(255, 255, 0) 'compose whatever highlight color you want with RGB values, I am using yellow here
Set xLastRng = Target

End Sub
This comment was minimized by the moderator on the site
work.... great...
This comment was minimized by the moderator on the site
Yes, I would like to know this as well. How would you keep the previously selected cells highlight for tracking purposes?
This comment was minimized by the moderator on the site
See my comment above.
There are no comments posted here yet
Load More
Please leave your comments in English
Posting as Guest
×
Rate this post:
0   Characters
Suggested Locations