refresh button

ttowncorp

Board Regular
Joined
Feb 2, 2015
Messages
187
Office Version
  1. 365
Platform
  1. Windows
I'm using the code at the bottom to highlight specific numbers in color. problem is some times when I add new data the code does not auto color the new data unless I go to "Developer, View Code," and hit the "RunSub/UserForm" play button. is there a way I can have that button on my excel sheet in a cell as well so I don't have to keep navigating to the developer tab, or is there a way in the coding you can to auto update itself when I add new data to it?


Function Highlighter()
Dim k As Long
Dim lrow As Long
lrow = Sheet4.Range("V" & Rows.Count).End(xlUp).Row
lrow1 = Sheet7.Range("d" & Rows.Count).End(xlUp).Row
For d = 2 To lrow
For k = 2 To lrow1
If Sheet7.Range("d" & k).Value = Sheet4.Range("v" & d).Value Then
Sheet7.Range("d" & k).Interior.ColorIndex = 44
End If
Next
Next

For k = 2 To lrow
For d = 2 To lrow1
If Sheet4.Range("v" & k).Value = Sheet7.Range("d" & d).Value Then
Sheet4.Range("v" & k).Interior.ColorIndex = 44
End If
Next
Next

End Function
 

Excel Facts

How to find 2nd largest value in a column?
MAX finds the largest value. =LARGE(A:A,2) will find the second largest. =SMALL(A:A,3) will find the third smallest
thank you but that got way over my head as in getting it to work. that sounded way more complicated than what I need. what about is there a way to loop it. have it always running so when I add data it will pick it up automatically?
 
Upvote 0
To make it volatile you would add this line of code to the UDF
Code:
Application.Volatile

You could also hit F9 to force the entire sheet to recalculate.
 
Upvote 0

Forum statistics

Threads
1,224,828
Messages
6,181,213
Members
453,024
Latest member
Wingit77

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top