Forum

Store Conditional F...
 
Notifications
Clear all

Store Conditional Formatting Using Macro

8 Posts
2 Users
0 Reactions
90 Views
(@david_ng)
Posts: 310
Reputable Member
Topic starter
 

BTW, just side track question is that a way we can store Conditional Formatting using Macro/VB script.

Pls refer attached, kindly advise the possibility, to create a Macro to store the Conditional format we have applied in a worksheet.

 
Posted : 18/08/2017 7:54 pm
(@sunnykow)
Posts: 1417
Noble Member
 

Hi David

Any reason why you would want to "store" the CF applied using VBA?

Sunny

 
Posted : 18/08/2017 8:01 pm
(@sunnykow)
Posts: 1417
Noble Member
 

Hi David

See if this is what you wanted.

Please note that the range, conditions, colors etc. have to be hard-coded. You will need to modify the codes to suit your needs.

Hope this helps.

Sunny

 
Posted : 18/08/2017 9:02 pm
(@david_ng)
Posts: 310
Reputable Member
Topic starter
 

Thansk Sunny the code that's  exactly what I want , I will modify the code for  application.

 
Posted : 21/08/2017 10:01 pm
(@david_ng)
Posts: 310
Reputable Member
Topic starter
 

Can we set a Macro to filter Data  base on "Date" criteria

For example in the sample file we want to filter in N column [ Vendor reply]

Today' s record and  date before yesterday's record? 

 
Posted : 21/08/2017 11:23 pm
(@sunnykow)
Posts: 1417
Noble Member
 

Hi David

You did not mention which column is the date to filter. I am assuming it to be column W so change it to suit your needs.

Sub FilterByDate()

Dim ColumnNo As Long

'Change to which column with date to filter
ColumnNo = 23 '(this is column W)

Range("A1").AutoFilter
Range("A1").AutoFilter Field:=ColumnNo, Criteria1:=">=" & CLng(Date - 1), Operator:=xlAnd, Criteria2:="<=" & CLng(Date)

End Sub

Sunny

 
Posted : 22/08/2017 12:43 am
(@david_ng)
Posts: 310
Reputable Member
Topic starter
 

Thanks  Sunny will try this VB

 
Posted : 22/08/2017 1:39 am
(@david_ng)
Posts: 310
Reputable Member
Topic starter
 

I did try and works OK , tks Sunny..

 
Posted : 22/08/2017 5:14 am
Share: