$$Excel-Macros$$ Conditional Formatting using VBA

2011-12-06 Thread George Barrowcliff
Excel 2007-

I have a spreadsheet that is updated frequently with new rows of data.

I have a conditional format that is set for all rows and each time I add a
new row I have to manually adjust the last row to encompass the newly added
one.

In the attached spreadsheet, new SKU data is added at the bottom of the
existing data.  Column B is conditionally formatted based on the average of
all elements in Column B starting at $B$3 and going through the last newly
added $B$[new row].  The format is over the same range.  i.e. $B$3 to
$B$[new row].

I would like to do this through VBA triggered with a command button.


Find the last cell and substitute it into the conditional format equation
and range using VBA is the question.


TIA

-- 
FORUM RULES (934+ members already BANNED for violation)

1) Use concise, accurate thread titles. Poor thread titles, like Please Help, 
Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will not get 
quick attention or may not be answered.

2) Don't post a question in the thread of another member.

3) Don't post questions regarding breaking or bypassing any security measure.

4) Acknowledge the responses you receive, good or bad.

5)  Cross-promotion of, or links to, forums competitive to this forum in 
signatures are prohibited. 

NOTE  : Don't ever post personal or confidential data in a workbook. Forum 
owners and members are not responsible for any loss.

--
To post to this group, send email to excel-macros@googlegroups.com


LastCell.xlsx
Description: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet


Re: $$Excel-Macros$$ Conditional Formatting using VBA

2011-12-06 Thread NOORAIN ANSARI
Dear George,

Please see attached sheet, I hope it will help to u.


-- 
Thanks & regards,
Noorain Ansari
 *http://excelmacroworld.blogspot.com/*
*http://noorain-ansari.blogspot.com/* 

On Wed, Dec 7, 2011 at 11:06 AM, George Barrowcliff wrote:

>
> Excel 2007-
>
> I have a spreadsheet that is updated frequently with new rows of data.
>
> I have a conditional format that is set for all rows and each time I add a
> new row I have to manually adjust the last row to encompass the newly added
> one.
>
> In the attached spreadsheet, new SKU data is added at the bottom of the
> existing data.  Column B is conditionally formatted based on the average of
> all elements in Column B starting at $B$3 and going through the last newly
> added $B$[new row].  The format is over the same range.  i.e. $B$3 to
> $B$[new row].
>
> I would like to do this through VBA triggered with a command button.
>
>
> Find the last cell and substitute it into the conditional format equation
> and range using VBA is the question.
>
>
> TIA
>
>
>  --
> FORUM RULES (934+ members already BANNED for violation)
>
> 1) Use concise, accurate thread titles. Poor thread titles, like Please
> Help, Urgent, Need Help, Formula Problem, Code Problem, and Need Advice
> will not get quick attention or may not be answered.
>
> 2) Don't post a question in the thread of another member.
>
> 3) Don't post questions regarding breaking or bypassing any security
> measure.
>
> 4) Acknowledge the responses you receive, good or bad.
>
> 5) Cross-promotion of, or links to, forums competitive to this forum in
> signatures are prohibited.
>
> NOTE : Don't ever post personal or confidential data in a workbook. Forum
> owners and members are not responsible for any loss.
>
>
> --
> To post to this group, send email to excel-macros@googlegroups.com
>

-- 
FORUM RULES (934+ members already BANNED for violation)

1) Use concise, accurate thread titles. Poor thread titles, like Please Help, 
Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will not get 
quick attention or may not be answered.

2) Don't post a question in the thread of another member.

3) Don't post questions regarding breaking or bypassing any security measure.

4) Acknowledge the responses you receive, good or bad.

5)  Cross-promotion of, or links to, forums competitive to this forum in 
signatures are prohibited. 

NOTE  : Don't ever post personal or confidential data in a workbook. Forum 
owners and members are not responsible for any loss.

--
To post to this group, send email to excel-macros@googlegroups.com


Copy of LastCell(Solved).xlsm
Description: application/vnd.ms-excel.sheet.macroenabled.12


Re: $$Excel-Macros$$ Conditional Formatting using VBA

2011-12-06 Thread NOORAIN ANSARI
Dear George,

Consider this one.

On Wed, Dec 7, 2011 at 11:06 AM, George Barrowcliff wrote:

>
> Excel 2007-
>
> I have a spreadsheet that is updated frequently with new rows of data.
>
> I have a conditional format that is set for all rows and each time I add a
> new row I have to manually adjust the last row to encompass the newly added
> one.
>
> In the attached spreadsheet, new SKU data is added at the bottom of the
> existing data.  Column B is conditionally formatted based on the average of
> all elements in Column B starting at $B$3 and going through the last newly
> added $B$[new row].  The format is over the same range.  i.e. $B$3 to
> $B$[new row].
>
> I would like to do this through VBA triggered with a command button.
>
>
> Find the last cell and substitute it into the conditional format equation
> and range using VBA is the question.
>
>
> TIA
>
>
>  --
> FORUM RULES (934+ members already BANNED for violation)
>
> 1) Use concise, accurate thread titles. Poor thread titles, like Please
> Help, Urgent, Need Help, Formula Problem, Code Problem, and Need Advice
> will not get quick attention or may not be answered.
>
> 2) Don't post a question in the thread of another member.
>
> 3) Don't post questions regarding breaking or bypassing any security
> measure.
>
> 4) Acknowledge the responses you receive, good or bad.
>
> 5) Cross-promotion of, or links to, forums competitive to this forum in
> signatures are prohibited.
>
> NOTE : Don't ever post personal or confidential data in a workbook. Forum
> owners and members are not responsible for any loss.
>
>
> --
> To post to this group, send email to excel-macros@googlegroups.com
>



-- 
Thanks & regards,
Noorain Ansari
 *http://excelmacroworld.blogspot.com/*
*http://noorain-ansari.blogspot.com/* 

-- 
FORUM RULES (934+ members already BANNED for violation)

1) Use concise, accurate thread titles. Poor thread titles, like Please Help, 
Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will not get 
quick attention or may not be answered.

2) Don't post a question in the thread of another member.

3) Don't post questions regarding breaking or bypassing any security measure.

4) Acknowledge the responses you receive, good or bad.

5)  Cross-promotion of, or links to, forums competitive to this forum in 
signatures are prohibited. 

NOTE  : Don't ever post personal or confidential data in a workbook. Forum 
owners and members are not responsible for any loss.

--
To post to this group, send email to excel-macros@googlegroups.com


Copy of LastCell(Solved).xlsm
Description: application/vnd.ms-excel.sheet.macroenabled.12


Re: $$Excel-Macros$$ Conditional Formatting using VBA

2011-12-09 Thread Rohan

Derived this from Noorain wondeful Solution. Some changes in the way
if have used vba.

Sub CF()

Dim CelRng As Range
LastRow = Range("B3").End(xlDown).Row
Set CelRng = Range("B3:B" & LastRow)

For i = 3 To LastRow
If Cells(i, "B").Value <
Application.WorksheetFunction.Average(CelRng) Then
Cells(i, "B").Interior.Color = vbCyan
End If
Next i

End Sub

Thanks,
Rohan

-- 
FORUM RULES (934+ members already BANNED for violation)

1) Use concise, accurate thread titles. Poor thread titles, like Please Help, 
Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will not get 
quick attention or may not be answered.

2) Don't post a question in the thread of another member.

3) Don't post questions regarding breaking or bypassing any security measure.

4) Acknowledge the responses you receive, good or bad.

5)  Cross-promotion of, or links to, forums competitive to this forum in 
signatures are prohibited. 

NOTE  : Don't ever post personal or confidential data in a workbook. Forum 
owners and members are not responsible for any loss.

--
To post to this group, send email to excel-macros@googlegroups.com