Try this If you have some Integer value in A Col.
Private Sub Worksheet_Change(ByVal Target As Range) Target.Resize(1, Target.Value).Select Selection.Interior.ColorIndex = xlyellow End Sub Private Sub Worksheet_SelectionChange(ByVal Target As Range) On Error GoTo Err: Application.EnableEvents = False If Target.Column = 1 And Target.Value > 0 Then Target.Resize(1, Target.Value).Select End If Err: Application.EnableEvents = True End Sub From: excel-macros@googlegroups.com [mailto:excel-macros@googlegroups.com] On Behalf Of ICWAI Help Sent: Wednesday, August 17, 2011 2:34 AM To: excel-macros@googlegroups.com Subject: Re: $$Excel-Macros$$ UDF Function for conditoin formetting Please find the attached file and give me the solution :) if the perticuler cell value is 4 then next 4 coloumn cells in same row shoudl be highleted . On Tue, Aug 16, 2011 at 11:42 PM, dguillett1 <dguille...@gmail.com> wrote: I did this VERY recently in another formum. Was it you? Right click sheet tab>view code>insert this Private Sub Worksheet_Change(ByVal Target As Range) Dim tr As Long tr = Target.Row Rows(tr).Borders(xlEdgeBottom).LineStyle = xlNone If Target.Column <> 1 Or Not IsNumeric(Target) Or _ Len(Application.Trim(Target)) < 1 Then Exit Sub Range(Cells(tr, 2), Cells(tr, Target + 1)) _ .Borders(xlEdgeBottom).LineStyle = xlContinuous End Sub From: ICWAI Help <mailto:icwai.answ...@gmail.com> Sent: Tuesday, August 16, 2011 11:02 AM To: excel-macros@googlegroups.com Subject: $$Excel-Macros$$ UDF Function for conditoin formetting Please provide me UDF functino for below requirement example:) if the cell value is 4 then including active cell next 4 cell in a row should be higleted with color. ex if a1 is 4 then a1 ,b1 ,c 1, d 1, f 1 should be higleted. Thansk, Rakesh. -- ---------------------------------------------------------------------------- ------ Some important links for excel users: 1. Follow us on TWITTER for tips tricks and links : http://twitter.com/exceldailytip 2. Join our LinkedIN group @ http://www.linkedin.com/groups?gid=1871310 3. Excel tutorials at http://www.excel-macros.blogspot.com <http://www.excel-macros.blogspot.com/> 4. Learn VBA Macros at http://www.quickvba.blogspot.com <http://www.quickvba.blogspot.com/> 5. Excel Tips and Tricks at http://exceldailytip.blogspot.com <http://exceldailytip.blogspot.com/> To post to this group, send email to excel-macros@googlegroups.com <><><><><><><><><><><><><><><><><><><><><><> Like our page on facebook , Just follow below link http://www.facebook.com/discussexcel -- ---------------------------------------------------------------------------- ------ Some important links for excel users: 1. Follow us on TWITTER for tips tricks and links : http://twitter.com/exceldailytip 2. Join our LinkedIN group @ http://www.linkedin.com/groups?gid=1871310 3. Excel tutorials at http://www.excel-macros.blogspot.com <http://www.excel-macros.blogspot.com/> 4. Learn VBA Macros at http://www.quickvba.blogspot.com <http://www.quickvba.blogspot.com/> 5. Excel Tips and Tricks at http://exceldailytip.blogspot.com <http://exceldailytip.blogspot.com/> To post to this group, send email to excel-macros@googlegroups.com <><><><><><><><><><><><><><><><><><><><><><> Like our page on facebook , Just follow below link http://www.facebook.com/discussexcel -- ---------------------------------------------------------------------------- ------ Some important links for excel users: 1. Follow us on TWITTER for tips tricks and links : http://twitter.com/exceldailytip 2. Join our LinkedIN group @ http://www.linkedin.com/groups?gid=1871310 3. Excel tutorials at http://www.excel-macros.blogspot.com 4. Learn VBA Macros at http://www.quickvba.blogspot.com 5. Excel Tips and Tricks at http://exceldailytip.blogspot.com To post to this group, send email to excel-macros@googlegroups.com <><><><><><><><><><><><><><><><><><><><><><> Like our page on facebook , Just follow below link http://www.facebook.com/discussexcel -- ---------------------------------------------------------------------------------- Some important links for excel users: 1. Follow us on TWITTER for tips tricks and links : http://twitter.com/exceldailytip 2. Join our LinkedIN group @ http://www.linkedin.com/groups?gid=1871310 3. Excel tutorials at http://www.excel-macros.blogspot.com 4. Learn VBA Macros at http://www.quickvba.blogspot.com 5. Excel Tips and Tricks at http://exceldailytip.blogspot.com To post to this group, send email to excel-macros@googlegroups.com <><><><><><><><><><><><><><><><><><><><><><> Like our page on facebook , Just follow below link http://www.facebook.com/discussexcel
Copy of UDF.xlsm
Description: application/vnd.ms-excel.sheet.macroenabled.12