Note: The other languages of the website are Google-translated. Back to English
Logáil isteach  \/ 
x
or
x
Cláraigh  \/ 
x

or

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! (Conair 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


Na hUirlisí Táirgiúlachta Oifige is Fearr

Réitíonn Kutools for Excel an chuid is mó de do chuid Fadhbanna, agus Méadaíonn sé do Tháirgiúlacht 80%

  • Athúsáid: Cuir isteach go tapa foirmlí casta, cairteacha agus aon rud a d'úsáid tú roimhe seo; Cealla a Chriptiú le pasfhocal; Cruthaigh Liosta Ríomhphoist agus seol ríomhphoist ...
  • Barra Foirmle Super (cuir línte iolracha téacs agus foirmle in eagar go héasca); Leagan Amach Léitheoireachta (líon mór cealla a léamh agus a chur in eagar go héasca); Greamaigh go dtí an Raon Scagtha...
  • Cumaisc Cealla / Sraitheanna / Colúin gan Sonraí a chailleadh; Ábhar Cealla Scoilt; Comhcheangail Sraitheanna / Colúin Dúblacha... Cill Dúblach a Chosc; Déan comparáid idir Ranganna...
  • Roghnaigh Dúblach nó Uathúil Sraitheanna; Roghnaigh Blank Rows (tá na cealla uile folamh); Aimsigh Super agus Fuzzy Aimsigh i go leor Leabhar Oibre; Roghnaigh go randamach ...
  • Cóip Díreach Cealla Il gan tagairt fhoirmle a athrú; Tagairtí Cruthaigh Auto chuig Bileoga Il; Cuir Urchair isteach, Boscaí Seiceála agus go leor eile ...
  • Sliocht Téacs, Cuir Téacs leis, Bain de réir Poist, Bain Spás; Subtotals Paging a chruthú agus a phriontáil; Tiontaigh Idir Ábhar Cealla agus Tráchtanna...
  • Scagaire Super (scéimeanna scagaire a shábháil agus a chur i bhfeidhm ar bhileoga eile); Ard-Sórtáil de réir míosa / seachtaine / lae, minicíocht agus níos mó; Scagaire Speisialta le cló trom, iodálach ...
  • Comhcheangail Leabhair Oibre agus Bileoga Oibre; Cumaisc Táblaí bunaithe ar eochaircholúin; Roinn Sonraí i Ilbhileoga; Baisc Tiontaigh xls, xlsx agus PDF...
  • Níos mó ná 300 gné chumhachtach. Tacaíochtaí Office / Excel 2007-2019 agus 365. Tacaíonn sé le gach teanga. Imscaradh éasca i d’fhiontar nó d’eagraíocht. Gnéithe iomlána triail saor in aisce 30 lá. Ráthaíocht ar ais airgid 60 lá.
cluaisín kte 201905

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á!
bun officetab
Say something here...
symbols left.
You are guest
or post as a guest, but your post won't be published automatically.
Loading comment... The comment will be refreshed after 00:00.
  • To post as a guest, your comment is unpublished.
    Vera · 7 months ago
    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
  • To post as a guest, your comment is unpublished.
    kiba fil · 1 years ago
    Thank you. Great Job
  • To post as a guest, your comment is unpublished.
    shea honig · 1 years ago
    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
    • To post as a guest, your comment is unpublished.
      Kris · 11 months ago
      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.
  • To post as a guest, your comment is unpublished.
    perry · 1 years ago
    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
  • To post as a guest, your comment is unpublished.
    Vishnu Subind · 1 years ago
    Hi guys, so i used to first code to change the cell colour to green/red on doubleclick/rightclick. I would like this code, however, to work just on a specific range of cells, in my case D9:P9. can someone help me on how to do that? Im new at VBA
    • To post as a guest, your comment is unpublished.
      crystal · 1 years ago
      Hi,
      The below VBA code can do you a favor, please have a try. Thank you for your comment.

      Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
      If (Not Application.Intersect(Target, Me.Range("D9:P9")) Is Nothing) Then
      Cancel = True
      Target.Interior.Color = vbRed
      End If
      End Sub
      Private Sub Worksheet_BeforeRightClick(ByVal Target As Range, Cancel As Boolean)
      If (Not Application.Intersect(Target, Me.Range("D9:P9")) Is Nothing) Then
      Cancel = True
      Target.Interior.Color = vbGreen
      End If
      End Sub
  • To post as a guest, your comment is unpublished.
    rahayu · 1 years ago
    trimakasih
  • To post as a guest, your comment is unpublished.
    rahayu · 1 years ago
    td muncul=tidak muncul
  • To post as a guest, your comment is unpublished.
    rahayu · 1 years ago
    Salam...
    sy sudah install kutools, tp kok td muncul tab kutools di layar excel ya? gmn cara mmunculkannya?trimakasih
  • To post as a guest, your comment is unpublished.
    vuongngocsangbkdn@gmail.com · 2 years ago
    I have a problem.
    I want change color of one hyperlink if it had linked with one PDF to RED and if had not link with one PDF will show BLUE color.
    How can I do now?
    • To post as a guest, your comment is unpublished.
      crystal · 2 years ago
      Good day,
      Sorry can't help you with that. Thanks for commenting.
  • To post as a guest, your comment is unpublished.
    devika.kalika@gmail.com · 2 years ago
    I tried the "Change the highlighted color when cells are selected with VBA code" option and saved my excel as Macro Enabled Worksheet. Now the last cells that were selected are highlighted and won't highlight other cells when selected. I've deleted code and reentered and saved, but still no change. I can't remove the previous highlight either. I'm at lost on what to do.
    • To post as a guest, your comment is unpublished.
      crystal · 2 years ago
      Hi,
      The code works well in my case after saving the workbook as an Excel Macro-Enabled Workbook.
      Can you tell me your Excel version?
  • To post as a guest, your comment is unpublished.
    Jason · 2 years ago
    Is there a way to just apply this to certain cells while leaving other cells with available for number entering?
  • To post as a guest, your comment is unpublished.
    Slaxx · 2 years ago
    hi. just a little heads up. i'm using office 2007.
    i tried your code, and while it did work, it wasn't what i was looking for. so i just deleted the code completely. but the last selected/active cell before i deleted the code is still green (i changed the color from vbYellow to vbGreen), and the color won't go away. it's not affected by fill color either.
    the simplest solution i found was to just delete the cell. copying and pasting will not work, it will also copy the color.
    just thought i'd let you know. you might find another solution/troubleshooting for this, besides deleting and manual entry. still, thanks! i confirm that the code works :)
  • To post as a guest, your comment is unpublished.
    Michelle · 2 years ago
    I love how easy formatting my worksheet the code for "change cell color when clicking on it" would make my daily work! I am hitting a snag though. When I copy my Blank Sheet with the code entered as described, I get a error. It runs great until I create new sheets. I am a novice at coding and am working from textbooks and the internet. I appreciate any help you will offer!
    • To post as a guest, your comment is unpublished.
      crystal · 2 years ago
      Dear Michelle,
      I followed the steps as you described, but the code also worked in my case. Can you tell me your Office version?
      Thanks for your comment.
  • To post as a guest, your comment is unpublished.
    madhav neupane · 3 years ago
    thank you thank you so much. I appreciate you for this.