+ Reply to Thread
Results 1 to 5 of 5

Set formatting of cell when changes made

  1. #1
    Forum Contributor
    Join Date
    05-28-2016
    Location
    Australia
    MS-Off Ver
    2013
    Posts
    119

    Set formatting of cell when changes made

    I have created a worksheet to track certain tasks. I am using the below VBA code to change all text before, and including, a semi-colon to bold as soon as i make a change to the cell, ie, when i enter text, the formatting is applied when i move onto another cell.
    The code achieves the desired result, but does so by starting at the top of the row at cell F18 and applying the formatting to each cell till the end of the row. I want to make this more efficient and only apply the formatting to the cell i was working on whether i hit enter, tab or click away from the cell.
    Attached is a cut down version of my spreadsheet.

    Please Login or Register  to view this content.
    Thank you in advance.
    Attached Files Attached Files

  2. #2
    Valued Forum Contributor
    Join Date
    11-26-2012
    Location
    Sydney
    MS-Off Ver
    2010
    Posts
    422

    Re: Set formatting of cell when changes made

    I think this will do what you want:
    Please Login or Register  to view this content.
    Incidently, when you declare variables like this:
    Please Login or Register  to view this content.
    only I is being declared as an integer. In VBA you need to declare every variable explicitly, i.e. :
    Please Login or Register  to view this content.
    Also, as Excel has more than a millions rows, and Integer can count nowhere near that high it is generally best to use Long. Even for small numbers, there is no harm in using it.

  3. #3
    Forum Contributor
    Join Date
    05-28-2016
    Location
    Australia
    MS-Off Ver
    2013
    Posts
    119

    Re: Set formatting of cell when changes made

    Thank you mgs73,

    That is certainly smaller and more efficient. However, all text in the cell is converted to bold, even if there isnt a semi-colon. I'd really like to have only text to the left, and including, the ";" converted to bold.
    Any thoughts?

  4. #4
    Valued Forum Contributor
    Join Date
    11-26-2012
    Location
    Sydney
    MS-Off Ver
    2010
    Posts
    422

    Re: Set formatting of cell when changes made

    How about this?
    Please Login or Register  to view this content.

  5. #5
    Forum Contributor
    Join Date
    05-28-2016
    Location
    Australia
    MS-Off Ver
    2013
    Posts
    119

    Re: Set formatting of cell when changes made

    Perfect!!!

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 6
    Last Post: 10-16-2017, 02:22 PM
  2. Macro to Save changes made to specific cell(s) and ignore all other changes made????
    By Omkar Balgobin in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 09-18-2017, 10:20 PM
  3. [SOLVED] Auto formatting when edits are made?????
    By SMITH.CRYSTAL in forum Excel General
    Replies: 1
    Last Post: 12-18-2015, 01:07 PM
  4. [SOLVED] How to make a dropdown list cell default to blank, after another cell selection is made
    By chardsmith in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 04-30-2013, 03:46 AM
  5. How to hide cells if the conditional formatting in column A has made them Green
    By Triscia in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-15-2013, 12:22 PM
  6. [SOLVED] Conditional Formatting made easier
    By troyakaTB in forum Excel General
    Replies: 2
    Last Post: 08-20-2012, 03:17 PM
  7. Replies: 5
    Last Post: 04-16-2012, 08:12 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1