Skip to main content

Conas dath na cille a athrú nuair a dhéantar cill a chliceáil nó a roghnú in Excel?

Taispeánfaidh an t-alt seo roinnt modhanna duit maidir le conas dath cille a athrú agus tú ag cliceáil ar chill, agus athróidh sé an dath aibhsithe agus tú ag roghnú raon cealla in Excel.

Athraigh dath na cille nuair a chliceáiltear cill le cód VBA
Athraigh an dath aibhsithe nuair a roghnaítear cealla le cód VBA
Aibhsigh an tsraith iomlán agus an colún de chill ghníomhach le Kutools for Excel


Athraigh dath na cille nuair a chliceáiltear cill le cód VBA

Anseo, is féidir leat dath cúlra cille a athrú trí chliceáil faoi dhó nó cliceáil ar dheis air leis an gcód VBA seo a leanas.

1. Sa bhileog oibre athróidh tú dath na cille agus tú ag cliceáil air, cliceáil ar dheis ar an táb bileog agus cliceáil Féach an cód ón roghchlár cliceáil ar dheis.

2. Sa Microsoft Visual Basic d’Fheidhmchláir fuinneog, cóipeáil agus greamaigh an cód VBA thíos sa cód fhuinneog.

VBA: athraigh dath na cille agus tú ag cliceáil air

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
    Target.Interior.Color = vbRed
End Sub
Private Sub Worksheet_BeforeRightClick(ByVal Target As Range, Cancel As Boolean)
    Target.Interior.Color = vbGreen
End Sub

3. Brúigh Eile + Q eochracha ag an am céanna chun an Microsoft Visual Basic d’Fheidhmchláir fhuinneog.

Ansin, nuair a chliceálann tú cill faoi dhó, beidh dath dearg uirthi. Agus nuair a chliceálann tú ar dheis ar chill, beidh dath glas air. Féach an pictiúr:


Cliceáil amháin chun aird a tharraingt ar a chéile agus ar cholún na cille roghnaithe in Excel:

Kutools le haghaidh Excel's Leagan Amach Léitheoireachta cuidíonn fóntais leat aird a tharraingt go tapa ar shraith agus ar cholún na cille roghnaithe 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á)


Athraigh an dath aibhsithe nuair a roghnaítear cealla le cód VBA

De réir réamhshocraithe, agus raon cealla á roghnú, tá an dath aibhsithe liath. Más mian leat an raon roghnaithe a dhéanamh níos seasmhaí, is féidir leat a dath aibhsithe a athrú go dtí an ceann a theastaíonn uait. Déan mar a leanas le do thoil.

1. Cliceáil ar dheis ar an táb bileog a theastaíonn uait dath aibhsithe an raoin roghnaithe a athrú, agus cliceáil Féach an cód ón roghchlár cliceáil ar dheis.

2. Sa Microsoft Visual Basic d’Fheidhmchláir fuinneog, cóipeáil agus greamaigh an cód VBA thíos sa cód fhuinneog.

Cód VBA: athraigh dath aibhsithe an raoin roghnaithe

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
    With Target
        .Worksheet.Cells.FormatConditions.Delete
        .FormatConditions.Add xlExpression, , "TRUE"
        .FormatConditions(1).Interior.Color = vbYellow
    End With
End Sub

3. Brúigh Eile + Q eochracha ag an am céanna chun an Microsoft Visual Basic d’Fheidhmchláir fhuinneog.

As seo amach, athraítear dath aibhsithe an raoin nó na cille roghnaithe go buí. Nuair a chliceálann tú cill eile nó raon cealla, déanfar na cealla a dhathú go huathoibríoch.


Aibhsigh an tsraith iomlán agus an colún de chill ghníomhach le Kutools for Excel

Má tá tú ag déileáil le bileog oibre mhór, is gá aird a tharraingt ar shraith agus ar cholún iomlán na cille gníomhaí d’fhonn an léitheoireacht a dhéanamh níos éasca. Seo an Leagan Amach Léitheoireachta fóntais de Kutools le haghaidh Excel Is féidir cabhrú leat.

Roimh iarratas a dhéanamh Kutools le haghaidh Excel, Le do thoil é a íoslódáil agus a shuiteáil ar dtús.

1. cliceáil Kutools > Leagan Amach Léitheoireachta. Féach an pictiúr:

Ansin cumasaítear an leagan amach léitheoireachta, is féidir leat a fheiceáil go bhfuil an tsraith agus an colún de chill ghníomhach aibhsithe láithreach.

nótaí: Is féidir leat socruithe an leagan amach léitheoireachta a athrú bunaithe ar do chuid riachtanas mar atá thíos an pictiúr a thaispeántar.

  Más mian leat triail saor in aisce (30 lá) a bheith agat ar an bhfóntas seo, cliceáil le do thoil chun é a íoslódáil, agus ansin téigh chun an oibríocht a chur i bhfeidhm de réir na gcéimeanna thuas.


Aibhsigh an tsraith iomlán agus an colún de chill ghníomhach le Kutools for Excel

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 (28)
No ratings yet. Be the first to rate!
This comment was minimized by the moderator on the site
Hello, i built a dashboard with 37 worksheets, everyone with a table. All of them are lock panels because are to large and i need to know the number and name of the student who am i entering data for. Despite that, i have to keep my finger on the left side of the screen to identify the names and numbers to which the entered data refer.  So, i need to identify the first two cells of the row, in the columns "I" and "J".
The code that i took from the internet and couldn't change for the two cells of columns "I" and "J" was:

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

All tables begin in diferent rows. This example start in 16 row but i put the code in all the pages and adapt to the needs of the specific row number. 
I've already tried to change the code from EntireRow to Range ("I16:J43") but the cells were in the range became all painted with the code color.
Already try a diferent way through the "conditional formatting" with the formula =E($I16<>"";LIN()=CÉL("lin")) in the range $I16:$J43, and in the developer "worksheet", with "Application.Calculate" and it works. I change in the 37 worksheets but i was copying and data from the previous file to this new one and I noticed that the options to paste "values", etc, disappear from my dashboard. The code must be executing something that, like clicking on the cell, no longer lets it paste. A single option was to paste with CTRL+V.
If someone can help me with the code, i'll delete the VBA "Application.Calculate" to to get back to the available collage options.
Thak you for your help.

Luís Lopes
This comment was minimized by the moderator on the site
Hello, the code used to work for a while, but now it doesn't anymore. What can there be wrong?
This comment was minimized by the moderator on the site
Hi Rens Borburgh,There are two codes provided in the post, which one did you use? Did you get any error prompt?
This comment was minimized by the moderator on the site
I have tried them both at the same time. After copying it to a usb stick it didn't work anymore.
This comment was minimized by the moderator on the site
Hi Rens Borburgh,I don't quite understand what you mean. The codes should be used in the sheet code window and not in the Module window. Or can you provide a screenshot of your code window?
This comment was minimized by the moderator on the site
Hi, I am trying to use the double click option to change a cell to green but i also want that cell to go back to no fill or white if i double click it whilst it is green. Is this possible? 
This comment was minimized by the moderator on the site
alguien que me ayude solo quiero que al hacerle click a una celda se ponga de un color y que se mantenga ese color y si le vuelvo hacer click regrese el color original que tenia
This comment was minimized by the moderator on the site
How to highlight the cell(with data) to automatically highlight the other cells (data which is related another data in a previous cell) with click of the cell.Can i do it. Is there a way to do it.
This comment was minimized by the moderator on the site
The code works as long as I do not protect the worksheet. Once I protect the worksheet, because I have conditional formatting on locked cells, the code will not work. How can I change this so that it works on locked worksheet where the user can select unlocked cells?
This comment was minimized by the moderator on the site
Hi,
is it possible to have a code for "change cell color when clicking on it" in the way that it will not change already formated cells with another color, please?
After applying your code all my formating (colours) is away. Thank you. Veronika
This comment was minimized by the moderator on the site
Thank you. Great Job
This comment was minimized by the moderator on the site
hi
the is working grate but i want that the color should only be when the cell is selected and when i select something else, the first cell i selcted should not be colored
can you help me pls with this thanks
This comment was minimized by the moderator on the site
I had that exact same question! I hope someone will answer you! The reason I am looking for this is I have a spreadsheet I use daily and put in lots of information into single cells. It gets hard to see the values (visually, it runs into info in other cells), and would be a great feature if I could change the color of the cell being edited - only while it is being edited. The simplest solution I can think of is that the cell value would be set back to what it was prior to being clicked on - but I don't know how to do that.
This comment was minimized by the moderator on the site
Hi, I am trying to figure out how to change the color of a cell, based on a selection from a dropdown list. For example, HIGH=red, MEDIUM=yellow, LOW=green.

Any tips you can provide are greatly appreciated. Thank You
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