Skip to main content

Conas marc seiceála a chur i gcill le cliceáil faoi dhó in Excel?

De ghnáth, chun marc seiceála a chur isteach i gcill, ní mór duit dul isteach sa bhosca dialóige Siombail, siombail an mharc seiceála a fháil agus é a chur isteach de láimh. Ach níl sé chomh furasta siombail an mharc seiceála a fháil amach sa bhosca dialóige Siombail mar tá go leor siombailí liostaithe istigh. Conas marc seiceála a chur go tapa i gcill in Excel? Taispeánfaidh an t-alt seo modh VBA duit chun marc seiceála a chur go héasca i gcill le cliceáil dúbailte amháin.

Cliceáil faoi dhó chun marc seiceála a chur i gcill le cód VBA


Cliceáil faoi dhó chun marc seiceála a chur i gcill le cód VBA

Is féidir leis an gcód VBA seo a leanas cabhrú leat marc seiceála a chur i gcill le cliceáil dúbailte. Déan mar a leanas le do thoil.

1. Oscail an bhileog oibre a theastaíonn uait chun marc seiceála a chur isteach sa chill, ansin cliceáil ar dheis agus roghnaigh Féach an cód ón roghchlár cliceáil ar dheis.

2. Sa Microsoft Visual Basic d’Fheidhmchláir an cód VBA thíos a fhuinneog, a chóipeáil agus a ghreamú isteach sa cód fhuinneog.

Cód VBA: Cliceáil faoi dhó chun an marc seiceála a chur i gcill

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
    If Not Intersect(Target, Range("B1:B10")) Is Nothing Then
        Application.EnableEvents = False
        If ActiveCell.Value = ChrW(&H2713) Then
            ActiveCell.ClearContents
        Else
            ActiveCell.Value = ChrW(&H2713)
        End If
        Cancel = True
    End If
    Application.EnableEvents = True
End Sub

nótaí: Sa chód, is é B1: B10 an raon a chuirfidh tú marc seiceála le cliceáil dúbailte. Athraigh é le do thoil bunaithe ar do riachtanas.

3. Brúigh an Eile + Q eochracha chun an Microsoft Visual Basic d’Fheidhmchláir fuinneog agus filleadh ar an mbileog oibre.

Anois, cliceáil faoi dhó ar aon chill i raon B1: B10, cuirfear an marc seiceála isteach go huathoibríoch. Agus an cill á chliceáil faoi dhó arís, bainfear an marc seiceála a cuireadh isteach.

Más gá duit na marcanna seiceála a úsáid go minic i d’obair laethúil Excel, molaim anseo an Téacs Auto Fóntais de Kutools le haghaidh Excel. Leis an ngné seo, is féidir leat marc seiceála a shábháil mar iontráil téacs uathoibríoch, agus ansin é a atosú sa todhchaí gan ach cliceáil amháin in Excel mar an taispeántas thíos a thaispeántar.
Íoslódáil agus bain triail as anois! (trasáil saor in aisce 30 lá)


Earraí gaolmhara:

Uirlisí Táirgiúlachta Oifige is Fearr

🤖 Kutools AI Aide: anailís sonraí a réabhlóidiú bunaithe ar: Forghníomhú Chliste   |  Gin Cód  |  Cruthaigh Foirmlí Saincheaptha  |  Anailís a dhéanamh ar Sonraí agus Cairteacha a Ghin  |  Feidhmeanna Kutools a agairt...
Gnéithe Coitianta: Faigh, Aibhsigh nó Aithnigh Dúblaigh   |  Scrios Sraitheanna Bána   |  Comhcheangail Colúin nó Cealla gan Sonraí a Chailleadh   |   Babhta gan Foirmle ...
Cuardaigh Super: Ilchritéir VLookup    VLookup Illuachanna  |   VLookup Trasna Ilbhileoga   |   Amharc doiléir ....
Liosta anuas Casta: Go tapa Cruthaigh Liosta Anuas   |  Liosta anuas Cleithiúnach   |  Liosta Buail Isteach Ilroghnacha ....
Bainisteoir Colún: Cuir Líon Sonrach Colún leis  |  Colúin Bog  |  Scoránaigh Stádas Infheictheachta na gColún Ceilte  |  Déan comparáid idir Raonta & Colúin ...
Gnéithe Réadmhaoin: Fócas Eangaí   |  Amharc Dearaidh   |   Barra Mór na Foirmle    Leabhar Oibre & Bainisteoir Bileog   |  Leabharlann Acmhainní (Uaththéacs)   |  Piocálaí Dáta   |  Comhcheangail Bileoga Oibre   |  Criptigh/Díchriptigh Cealla    Seol Ríomhphost trí Liosta   |  Scagaire Super   |   Scagaire Speisialta (scagaire trom/iodálach/stailc tríd...) ...
Barr 15 Uirlisí12 Téacs uirlisí (Cuir Téacs, Bain Carachtair,...)   |   50 + Cairt cineálacha (Cairt Gantt,...)   |   40+ Praiticiúil Foirmlí (Ríomh aois bunaithe ar lá breithe,...)   |   19 Insertion uirlisí (Cuir isteach Cód QR, Ionsáigh Pictiúr ón gCosán,...)   |   12 Tiontú uirlisí (Uimhreacha le Focail, Comhshó Airgeadra,...)   |   7 Cumaisc & Scoilt uirlisí (Sraitheanna Comhcheangail Casta, Cealla Scoilt,...)   |   ... agus eile

Supercharge Do Scileanna Excel le Kutools le haghaidh Excel, agus Éifeachtúlacht Taithí Cosúil Ná Roimhe. Kutools le haghaidh Excel Tairiscintí Níos mó ná 300 Ardghnéithe chun Táirgiúlacht a Treisiú agus Sábháil Am.  Cliceáil anseo chun an ghné is mó a theastaíonn uait a fháil ...

Tuairisc


Tugann Tab Oifige comhéadan Tabbed chuig Office, agus Déan Do Obair i bhfad Níos Éasca

  • Cumasaigh eagarthóireacht agus léamh tabbed i Word, Excel, PowerPoint, Foilsitheoir, Rochtain, Visio agus Tionscadal.
  • Oscail agus cruthaigh cáipéisí iolracha i gcluaisíní nua den fhuinneog chéanna, seachas i bhfuinneoga nua.
  • Méadaíonn do tháirgiúlacht 50%, agus laghdaíonn sé na céadta cad a tharlaíonn nuair luch duit gach lá!
Comments (13)
Rated 5 out of 5 · 1 ratings
This comment was minimized by the moderator on the site
hello bro, is it possible to add an icon?
for example double-click the first checklist icon ,and if you double click the second cross icon appears ,and double click the last to go blank .
Rated 5 out of 5
This comment was minimized by the moderator on the site
Bonjour,

Une fois ces cases cochées, j'aimerais qu'une cellule x m'additionne les chiffres d'une certaine colonne, est ce possible ?

Merci à vous, bonne soirée
This comment was minimized by the moderator on the site
How do I make it so that it adds a time stamp on the adjacent cell after the double click?
This comment was minimized by the moderator on the site
Hi Sora,
The following VBA code can do you a favor. Please give it a try. Thank you.
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
'Updated by Extendoffice 20221125
    Dim xRight As Range
    Dim KeyCells As Range
    Set KeyCells = Range("B1:B10")
    Set xRight = Target.Offset(0, 1)
    If Not Application.Intersect(KeyCells, Range(Target.Address)) Is Nothing Then
        xRight.Value = Now()
    End If
Application.EnableEvents = True
End Sub
This comment was minimized by the moderator on the site
Eu gostaria de saber se é possível adicionar a marca com apenas um clique ao invés de dois.
This comment was minimized by the moderator on the site
Hi Ulisses Nonato,
If you want to add a check mark to a cell with only one mouse click, the following VBA code can do you a favor.
You need to click the right mouse button to activate the code.
Private Sub Worksheet_BeforeRightClick(ByVal Target As Range, Cancel As Boolean)
    'Updated by Extendoffice 20220714
    If Not Intersect(Target, Range("B1:B10")) Is Nothing Then
        Application.EnableEvents = False
        If ActiveCell.Value = ChrW(&H2713) Then
            ActiveCell.ClearContents
        Else
            ActiveCell.Value = ChrW(&H2713)
        End If
        Cancel = True
    End If
    Application.EnableEvents = True
End Sub
This comment was minimized by the moderator on the site
How do i repeat this for multiple columns? 
For example i need it in the following:
E, F, I, J, M, N ,Q, R, U, V, Y, Z, AC, AD, AG, AH, AK, AL, AO, AP, AS, AT, AW, AX
This comment was minimized by the moderator on the site
Hi crystal
is there a way to have checkmarks in A1:A10 along with B3:B10?
This comment was minimized by the moderator on the site
Hi there! What would I add to the above code to get the cell to change color when the check box is added?
This comment was minimized by the moderator on the site
Is there a way to loop this code so that it is on a lot of worksheets in one workbook?
This comment was minimized by the moderator on the site
Hi leoflute,After pressing the Alt + F11 keys to open the Microsoft Visual Basic for Applications window, please double click ThisWorkbook to open the ThisWorkbook(Code) window, and then copy the below code into the code window. Don't forget to change the sheet names and the cell range in the code.<div data-tag="code">Private Sub Workbook_SheetBeforeDoubleClick(ByVal Sh As Object, ByVal Target As Range, Cancel As Boolean)
'Updated by Extendoffice 20201012
Dim xStrRg, xStrWs, xStrWsName As String
Dim xEEBol, xWSNBol, xBol As Boolean
Dim xArrWs
Dim xArrRg
Dim xI, xJ As Integer
Dim xWs As Worksheet
Dim xRg As Range

xStrWs = "Sheet5,Sheet1,Sheet2" 'The specific worksheet names
xStrRg = "B3:B10" 'The range of cells you will insert check marks
xArrWs = Split(xStrWs, ",")
xArrRg = Split(xStrRg, ",")

xEEBol = Application.EnableEvents
Application.EnableEvents = False
On Error Resume Next
xStrWsName = Sh.Name
xBol = False
xWSNBol = False
For xI = 0 To UBound(xArrWs)
If xStrWsName = xArrWs(xI) Then
xWSNBol = True
Exit For
End If
Next xI

If xWSNBol Then
Set xWs = Application.Worksheets.Item(xArrWs(xI))
For xJ = 0 To UBound(xArrRg)
Set xRg = Sh.Range(xArrRg(xJ))
If Not Intersect(Target, xRg) Is Nothing Then
xBol = True
Exit For
End If
Next xJ
End If

If xBol Then
If ActiveCell.Value = ChrW(&H2713) Then
ActiveCell.ClearContents
Else
ActiveCell.Value = ChrW(&H2713)
End If
Cancel = True
End If
Application.EnableEvents = xEEBol
End Sub

This comment was minimized by the moderator on the site
como eu faço pra inserir a marca de seleção na célula, porém sem deletar o número que estiver digitado nela ou seja, a marca sairia na frente do número quando eu der duplo clique... e quando eu quizer apagar a marca, eu dou duplo clique novamente e a célula voltaria ao normar (continuaria apenas o número).
This comment was minimized by the moderator on the site
Ola Luiz, tente essa alteracao. Ira funcionar nas celulas A2:A10 e D2:D5, altere conforme sua necessidade.

Tadao


Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
If Not Intersect(Target, Union(Range("A2:A10"), Range("D2:D5"))) Is Nothing Then
Application.EnableEvents = False
If Left(ActiveCell.Value, 1) = ChrW(&H2713) Then
ActiveCell.Value = Right(ActiveCell, Len(ActiveCell) - 1)
ActiveCell.HorizontalAlignment = xlRight
Else
ActiveCell.Value = ChrW(&H2713) & ActiveCell.Value
End If
Cancel = True
End If
Application.EnableEvents = True
End Sub
There are no comments posted here yet
Please leave your comments in English
Posting as Guest
×
Rate this post:
0   Characters
Suggested Locations