filmov
tv
Click A Check Box To Run Macro In A To Do List In Excel || MS Excel Tutorials
Показать описание
In the last video we have seen how to link all check boxes with a macro in Excel. Now in this video, let us learn how to run a macro when we click on a check box.
👀 Best Laptops to use for better speed:
In this example, I am considering this small To-Do list, where the checkboxes in column C are linked to cells in column D.
Now, let us try building a macro that puts the actual date in the column F, when you tick the check box in column C.
Go to the VBA editor window, insert a new module.
And type the code like this.
Sub CheckBoxDate()
Dim ws As Worksheet
Dim chk As CheckBox
Dim lColD As Long
Dim lColChk As Long
Dim lRow As Long
Dim rngD As Range
lColD = 3
Set ws = ActiveSheet
Set chk = ws.CheckBoxes(Application.Caller)
lRow = chk.TopLeftCell.Row
lColChk = chk.TopLeftCell.Column
Set rngD = ws.Cells(lRow, lColChk + lColD)
Select Case chk.Value
Case 1
rngD.Value = Date
Case Else
rngD.ClearContents
End Select
End Sub
Go to the excel now, right click the first checkbox and click on Assign macro, In the list of macros, click CheckBoxDate, then click OK.
VBA-2:
Sub CheckBoxMacro()
Dim chk As CheckBox
For Each chk In ActiveSheet.CheckBoxes
chk.OnAction = "CheckBoxDate"
Next chk
End Sub
📒Our Recommendations
***************************************************************
If you found this video valuable, give it a like. If you know someone who needs to see it, share it. Leave a comment below with your thoughts. Add it to a playlist if you want to watch it later.
***********************************************
⚡️Tools for YouTube vlogging:
***********************************************
***********************************************
⚡️You Can Connect with Me at:
***********************************************
#dptutorials #primavera #primaverafree #exceltraining #exceltricks #exceltips #excelfreetraining #excelfreelearning
⚡️Tags: -
excel formulas in english, excel in english, excel tutorial in english,ms excel in english,ms excel tutorial in english, learn excel in english,vlookup in excel in english, learn ms excel in english, excel training, excel tutorial, microsoft excel 2007, learn excel,tutorial excel, ms excel tutorial, excel tutorials,ms excel 2007,microsoft excel training,learn excel online,learning excel,free excel training,online excel training,advanced excel tutorial,excel tutorial, excel formulas and functions, excel formulas, excel tutorial in hindi, excel formulas and functions in hindi, excel tricks, excel in hindi, excel shortcut keys, excel vlookup, excel formulas in hindi, excel for beginners, excel for accounting, excel formulas and functions tutorial, excel sum formula, sum formula series, excel attendance sheet, excel salary sheet, excel stock maintain, excel data entry, advanced excel tutorial,excel formulas,excel tutorial,vlookup excel,excel accounting
🎁Note: This description contains affiliate links, which means at no additional cost to you, we will receive a small commission if you make a purchase using the links. This helps support the channel and allows us to continue to make videos like this. Thank you for your support!
👀 Best Laptops to use for better speed:
In this example, I am considering this small To-Do list, where the checkboxes in column C are linked to cells in column D.
Now, let us try building a macro that puts the actual date in the column F, when you tick the check box in column C.
Go to the VBA editor window, insert a new module.
And type the code like this.
Sub CheckBoxDate()
Dim ws As Worksheet
Dim chk As CheckBox
Dim lColD As Long
Dim lColChk As Long
Dim lRow As Long
Dim rngD As Range
lColD = 3
Set ws = ActiveSheet
Set chk = ws.CheckBoxes(Application.Caller)
lRow = chk.TopLeftCell.Row
lColChk = chk.TopLeftCell.Column
Set rngD = ws.Cells(lRow, lColChk + lColD)
Select Case chk.Value
Case 1
rngD.Value = Date
Case Else
rngD.ClearContents
End Select
End Sub
Go to the excel now, right click the first checkbox and click on Assign macro, In the list of macros, click CheckBoxDate, then click OK.
VBA-2:
Sub CheckBoxMacro()
Dim chk As CheckBox
For Each chk In ActiveSheet.CheckBoxes
chk.OnAction = "CheckBoxDate"
Next chk
End Sub
📒Our Recommendations
***************************************************************
If you found this video valuable, give it a like. If you know someone who needs to see it, share it. Leave a comment below with your thoughts. Add it to a playlist if you want to watch it later.
***********************************************
⚡️Tools for YouTube vlogging:
***********************************************
***********************************************
⚡️You Can Connect with Me at:
***********************************************
#dptutorials #primavera #primaverafree #exceltraining #exceltricks #exceltips #excelfreetraining #excelfreelearning
⚡️Tags: -
excel formulas in english, excel in english, excel tutorial in english,ms excel in english,ms excel tutorial in english, learn excel in english,vlookup in excel in english, learn ms excel in english, excel training, excel tutorial, microsoft excel 2007, learn excel,tutorial excel, ms excel tutorial, excel tutorials,ms excel 2007,microsoft excel training,learn excel online,learning excel,free excel training,online excel training,advanced excel tutorial,excel tutorial, excel formulas and functions, excel formulas, excel tutorial in hindi, excel formulas and functions in hindi, excel tricks, excel in hindi, excel shortcut keys, excel vlookup, excel formulas in hindi, excel for beginners, excel for accounting, excel formulas and functions tutorial, excel sum formula, sum formula series, excel attendance sheet, excel salary sheet, excel stock maintain, excel data entry, advanced excel tutorial,excel formulas,excel tutorial,vlookup excel,excel accounting
🎁Note: This description contains affiliate links, which means at no additional cost to you, we will receive a small commission if you make a purchase using the links. This helps support the channel and allows us to continue to make videos like this. Thank you for your support!
Комментарии