highlight cell if meet condition

jannahbuang

New Member
Joined
Jul 3, 2014
Messages
8
how can i insert the content in 'title' column in table 1 to empty cell in table 2 like shown below in vba and highlight the cell with red colour after that?
i want to know how the logic will be. table 1 will be in sheet 1 and table 2 will be in sheet 2.

DateProcessTitle
25-Feb-13PackagingPE Foam Optimization
3-Mar-13IPRINTIPRINT Screen/Squeegee Lifetime Extension
2-Apr-13RANTEXTest1
3-Apr-13SMATTest2
3-Apr-13RANTEXTest3
5-Apr-13PLMTest4
5-Apr-13BARCTest5
5-Apr-13PLATINGTest6

<tbody>
</tbody>




JanFebMarApr
Packaging
IPRINT
RANTEX
PLMTest4
BARCTest5
PLATINGTest6

<tbody>
</tbody>
 
Last edited:

Excel Facts

Spell Check in Excel
Press F7 to start spell check in Excel. Be careful, by default, Excel does not check Capitalized Werds (whoops)
Hi and welcome to the board I can offer the an alternative solution which is formula based.

Ok First in Sheet 2 make sure the Jan, Feb, Mar, Apr are date formatted to mmm and are based on actual dates in those cells the have e.g. 01/01/2013, 01/02,2013 etc

Then in Sheet2 Cell B2

=IF(MONTH(INDIRECT("Sheet1!$A$"&MATCH($A2,Sheet1!$B$1:$B$9,0)))=MONTH(B$1),VLOOKUP($A2,Sheet1!$B$2:$C$9,2,0),"")

copy that across to E2 that line is done and unique

Sheet2 Cell B3

=IF(MONTH(INDIRECT("Sheet1!$A$"&MATCH($A4,Sheet1!$B$1:$B$9,0)))=MONTH(B$1),VLOOKUP($A4,Sheet1!$B$2:$C$9,2,0),"")

copy that across to E2 and down

so if your range if bigger just copy down from the bottom line.

As far as Conditional formatting is concerned

you can do that in the menu and the formula would be =B2<>"" for the range $B$2:$E$7

Cheers
 
Upvote 0
Just noticed both formulas are the same so you only need to put the first 1 in cell B2 and copy to range

Cheers
 
Upvote 0
Ok if you put this in Module 1 it should work - everytime you want to refresh the data run the macro

Sub MatchandpaintRed()

Sheets("Sheet1").Select
Range("B1").Select
ActiveCell.Columns("A:A").EntireColumn.Select
Selection.Copy
Sheets("Sheet2").Select
Range("A1").Select
ActiveCell.Columns("A:A").EntireColumn.Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
ActiveSheet.Range("A:A").RemoveDuplicates Columns:=1, Header:=xlNo
ActiveCell.Offset(1, 1).Select
If IsEmpty(cell) Then
Range(Selection, Selection.End(xlDown)).Select
Range(Selection, Selection.End(xlToRight)).Select
Selection.ClearContents
End If
Range("B2").Select
ActiveCell.FormulaR1C1 = _
"=IF(MONTH(INDIRECT(""Sheet1!$A$""&MATCH(RC1,Sheet1!R1C2:R9C2,0)))=MONTH(R1C),VLOOKUP(RC1,Sheet1!R2C2:R9C3,2,0),"""")"
Selection.Copy
ActiveCell.Offset(0, -1).Range("A1").Select
Selection.End(xlDown).Select
ActiveCell.Offset(0, 1).Range("A1").Select
ActiveSheet.Paste
Range(Selection, Selection.End(xlUp)).Select
ActiveSheet.Paste
Range(Selection, Selection.End(xlDown)).Select
Application.CutCopyMode = False
Selection.Copy
ActiveCell.Offset(0, 1).Range("A1").Select
ActiveSheet.Paste
ActiveCell.Offset(0, 1).Range("A1").Select
ActiveSheet.Paste
ActiveCell.Offset(0, 1).Range("A1").Select
ActiveSheet.Paste
Application.CutCopyMode = False
ActiveCell.Activate
Range("B2").Select
Selection.FormatConditions.Add Type:=xlExpression, Formula1:="=B2<>"""""
Selection.FormatConditions(Selection.FormatConditions.Count).SetFirstPriority
With Selection.FormatConditions(1).Interior
.PatternColorIndex = xlAutomatic
.Color = 255
.TintAndShade = 0
End With
Selection.FormatConditions(1).StopIfTrue = False
Selection.Copy
Range(Selection, Selection.End(xlDown)).Select
Range(Selection, Selection.End(xlToRight)).Select
Selection.PasteSpecial Paste:=xlPasteFormats, Operation:=xlNone, _
SkipBlanks:=False, Transpose:=False
Application.CutCopyMode = False
End Sub

Cheers
 
Upvote 0

Forum statistics

Threads
1,221,418
Messages
6,159,791
Members
451,589
Latest member
Harold14

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