+ Reply to Thread
Results 1 to 10 of 10

Adjusting a Macro for Highlighted cell input changes

  1. #1
    Registered User
    Join Date
    01-15-2013
    Location
    Kansas City
    MS-Off Ver
    Excel 2007
    Posts
    75

    Adjusting a Macro for Highlighted cell input changes

    Please see attached. Current macro runs on highlighted yellow columns so that if someone makes a change it highlights it blue. In addition now, it would be awesome that if one of those highlighted yellow cells was blank and someone put a price in that it would also highlight blue. Could someone help me adjust this macro to do that? Ignore red cells because those are conditionally formatted. Highlighted cells are on all three tabs.
    Attached Files Attached Files

  2. #2
    Forum Expert judgeh59's Avatar
    Join Date
    02-07-2013
    Location
    Boise, Idaho
    MS-Off Ver
    Excel 2016
    Posts
    2,310

    Re: Adjusting a Macro for Highlighted cell input changes

    will this work for you?

    Please Login or Register  to view this content.
    Ernest

    Please consider adding a * if I helped

    Nothing drives me crazy - I'm always close enough to walk....

  3. #3
    Registered User
    Join Date
    01-15-2013
    Location
    Kansas City
    MS-Off Ver
    Excel 2007
    Posts
    75

    Re: Adjusting a Macro for Highlighted cell input changes

    It works on the example sheet I attached. However, my actual copy now has more columns added to the spreadsheet. Can you tell me how to adjust the macro or can you re-figure to where the column letters appear in it? That way I could adjust the target column letters as I revise my spreadsheet.

  4. #4
    Registered User
    Join Date
    01-15-2013
    Location
    Kansas City
    MS-Off Ver
    Excel 2007
    Posts
    75

    Re: Adjusting a Macro for Highlighted cell input changes

    This is the macro that I currently have in my spreadsheet. It targets the exact columns I need ("J" and "W"). Is it possible for you to add the coding that will highlight cells blue if someone inputs a value into a blank cell within columns "J" and "W"? Currently the macro listed below just targets changes to cells within those two columns. Hope this helps.

    Public val As Variant
    Private Sub Worksheet_Change(ByVal Target As Range)
    Dim rng As Range
    If Target.Count > 1 Then Exit Sub
    Set rng = Union(Range("J:J"), Range("W:W"))
    If Not Intersect(Target, rng) Is Nothing Then
    If Target <> val And val <> "" Then
    Target.Interior.ColorIndex = 28
    End If
    End If
    End Sub

    Private Sub Worksheet_SelectionChange(ByVal Target As Range)
    Dim rng As Range
    If Target.Count > 1 Then Exit Sub
    Set rng = Union(Range("J:J"), Range("W:W"))
    If Not Intersect(Target, rng) Is Nothing Then
    val = Target
    End If
    End Sub
    Last edited by eguirocker3; 09-26-2014 at 04:00 PM.

  5. #5
    Forum Expert judgeh59's Avatar
    Join Date
    02-07-2013
    Location
    Boise, Idaho
    MS-Off Ver
    Excel 2016
    Posts
    2,310

    Re: Adjusting a Macro for Highlighted cell input changes

    is post #4 showing that this works and you figured it out? or what you done and it's not working?....thanks

  6. #6
    Registered User
    Join Date
    01-15-2013
    Location
    Kansas City
    MS-Off Ver
    Excel 2007
    Posts
    75

    Re: Adjusting a Macro for Highlighted cell input changes

    The initial attachment (post #1) was a dummy example that I have since added more columns to now. Your macro does not work since I added more columns.

    The macro in post #4 is what I have in my new spreadsheet with more columns. It works if someone changes prices in the highlighted yellow cells (columns J & W) but will not highlight blue if the cell is blank and someone inputs a new value. That's the part I'm missing.

  7. #7
    Forum Expert judgeh59's Avatar
    Join Date
    02-07-2013
    Location
    Boise, Idaho
    MS-Off Ver
    Excel 2016
    Posts
    2,310

    Re: Adjusting a Macro for Highlighted cell input changes

    give this a try.....

    on a side note....before the Moderators let you know....you should be wrapping your code in code tags...makes it easy to read and copy, so we can help you better/faster...thanks...

    Please Login or Register  to view this content.

  8. #8
    Registered User
    Join Date
    01-15-2013
    Location
    Kansas City
    MS-Off Ver
    Excel 2007
    Posts
    75

    Re: Adjusting a Macro for Highlighted cell input changes

    It still won't show blue when someone inputs into a blank cell. To simplify, I have created another example spreadsheet in which I took a lot of information out but the columns and format remain intact with the real version.

    I need the macro to highlight the cells blue within the yellow columns if someone changes a value or inputs a value into a blank cell. Current macro within the spreadsheet only highlight blue for changes and not if someone inputs a new value into a blank cell. I like your macros above that have the ranges and column letters in them so that I can easier follow along and adjust macro if I add more columns to spreadsheet. I appreciate all your help and feedback so far
    Attached Files Attached Files

  9. #9
    Forum Expert judgeh59's Avatar
    Join Date
    02-07-2013
    Location
    Boise, Idaho
    MS-Off Ver
    Excel 2016
    Posts
    2,310

    Re: Adjusting a Macro for Highlighted cell input changes

    Sorry it took so long....I had a project at work....go figure...

    I believe this code should work...one thing I did notice is you have a conditional format in column N that may be overwriting the VBA Code....you might want to check that out....

    Please Login or Register  to view this content.

  10. #10
    Registered User
    Join Date
    01-15-2013
    Location
    Kansas City
    MS-Off Ver
    Excel 2007
    Posts
    75

    Re: Adjusting a Macro for Highlighted cell input changes

    thanks. You the best!

+ 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. [SOLVED] Excel Macro to insert copied row to the cell I currently have highlighted
    By badrum in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 05-16-2014, 03:17 PM
  2. Macro Help that will place value in Cell if row is highlighted
    By C53105 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 05-14-2013, 04:48 PM
  3. Problem adjusting macro for different cell refernces
    By toph1903 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-30-2013, 08:41 AM
  4. [SOLVED] input date column A, increment B, select blank cell in D and input time. in a macro
    By jeffstu in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 09-19-2012, 11:19 AM
  5. [SOLVED] Run macro when cell is highlighted.
    By Defoes Right Boot in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-24-2006, 08:10 AM

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