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

كيفية النقر نقرًا مزدوجًا فوق خلية وإضافة 1 إلى قيمة تلك الخلية في Excel؟

ستوضح لك هذه المقالة طريقة إضافة 1 إلى قيمة الخلية تلقائيًا بالنقر المزدوج عليها في Excel.

انقر نقرًا مزدوجًا فوق خلية وأضف 1 برمز VBA


انقر نقرًا مزدوجًا فوق خلية وأضف 1 برمز VBA

يمكن أن تساعدك التعليمات البرمجية لـ VBA التالية في إضافة 1 إلى قيمة الخلية بعد النقر المزدوج. الرجاء القيام بما يلي.

1. انقر بزر الماوس الأيمن فوق علامة تبويب الورقة التي قيم الخلية التي تريد إضافة 1 إليها بالنقر المزدوج. ثم اضغط عرض الرمز من قائمة النقر بزر الماوس الأيمن.

2. في ظهرت ميكروسوفت فيسوال باسيك للتطبيقات نافذة ، انسخ والصق رمز فبا أدناه في نافذة التعليمات البرمجية.

رمز فبا: أضف 1 إلى قيمة خلية بالنقر المزدوج

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
    On Error Resume Next
    If Not Intersect(Target, Range("A1")) Is Nothing Then
      Range("A1").Value = Range("A1").Value + 1
      Cancel = True
    End If
End Sub

ملاحظات: في الكود ، A1 هي الخلية التي ستضيف الرقم 1 إليها بالنقر المزدوج.

3. اضغط على قديم + Q مفاتيح في نفس الوقت لإغلاق نافذة ميكروسوفت فيسوال باسيك للتطبيقات.

الآن ، انقر نقرًا مزدوجًا فوق الخلية A1 سيضيف 1 إلى القيمة الحالية كما هو موضح أدناه.


مقالات ذات صلة:

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

🤖 مساعد 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 (17)
No ratings yet. Be the first to rate!
This comment was minimized by the moderator on the site
how can i answer by YES or NO by adding check mark?
This comment was minimized by the moderator on the site
What code would I you if I want to add 1 to multiple cells lets say E5:E15 but then add .5 or a different number to another group of cells like G5:515?
This comment was minimized by the moderator on the site
I cannot get this to work in multiple cells
Tried using, but it did not work


Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
On Error Resume Next
If Not Intersect(Target, Range("B2:L14")) Is Nothing Then
Range("B2:L14").Value = Range("B2:L14").Value + 1
Cancel = True
End If
End Sub
This comment was minimized by the moderator on the site
Hi Stella,
Please apply the below VBA to solve the problem.

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)

On Error Resume Next

If Not Intersect(Target, Range("B2:L14")) Is Nothing Then

Target.Value = Target.Value + 1

Cancel = True

End If

End Sub
This comment was minimized by the moderator on the site
If you want to increment any cell in a workbook cell by double clicking on that cell but only that cell, this code works:

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
On Error Resume Next
If Not Intersect(Target, Range(ActiveCell.Address)) Is Nothing Then
ActiveCell.Value = ActiveCell.Value + 1
Cancel = True
End If
End Sub
This comment was minimized by the moderator on the site
Dear Bill,
Thank you for sharing.
This comment was minimized by the moderator on the site
Thank You! that helped me a lot!
This comment was minimized by the moderator on the site
This is great! How do I do this for multiple cells? I type in "A1,A2" instead "A1", it makes both cells equal and adds 1 to both cells simultaneously. I'd like the cells to act independently.
This comment was minimized by the moderator on the site
Sorry I didn’t get your point.
This comment was minimized by the moderator on the site
Hello - agree with Steve this is great. I think what he would like (and me too) is to be able to add to the value of multiple different cells in the same tab by double clicking on them. He has amended the VBA formula so it says "A1,A2" instead of just "A1" however double clicking on "A1" adds 1 to both cells. Is it possible to change the formula so that multiple cells are included with the value of each only being increased when you click on it directly?
This comment was minimized by the moderator on the site
maybe by making a table with a range name. and updating the formula to include that?
This comment was minimized by the moderator on the site
Basically, with the code above, if you double clicked on A1, it would add 1 to A1. If I changed A1 to A1:A2 in the Target Range, then if I double clicked on A1 or A2, it would add 1 to A1. What I wanted was to add 1 to A1 only if I double clicked on A1, and add 1 to A2 only if I double clicked on A2. I also did not want to add 1 to both cells.

I think I have found what I was looking for:

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
If Not Intersect(Target, Range("D5:BC56")) Is Nothing Then
Cancel = True
Range(Target.Address).Value = Val(Range(Target.Address).Value) + 1
End If
End Sub
This comment was minimized by the moderator on the site
This code does not seem to work for me. Don't I have to specify which is the Target.Adress ?
This comment was minimized by the moderator on the site
Dear Steve,
I got your point finally, and thank you for sharing.
This comment was minimized by the moderator on the site
Can we add a two digit number to the end of the date? for example i need to double click and add the current date and the next two digit number (20171030-01 then the next cell will show 20171030-02 upon double click)
This comment was minimized by the moderator on the site
Dear Matt,
The code only supports the number format cell. It can't work as your data 20171030-01 is text format. Sorry about that.
This comment was minimized by the moderator on the site
Dear Matt,
The code only supports the number format cell. It can work as your data 20171030-01 is a text format. Sorry about that.
There are no comments posted here yet
Please leave your comments in English
Posting as Guest
×
Rate this post:
0   Characters
Suggested Locations