View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Hari[_3_] Hari[_3_] is offline
external usenet poster
 
Posts: 157
Default Worksheet_change - Murdering syntax

Hi,

I have some a column N in a sheet called Raw Data. I have a cell dropdown
saying "Yes" or "No".

It could be possible that this Yes or No data is pasted from some other
workbook in to Column N.

I desire that if any row (starting from row no. 3 to used rows) within
Column N has Yes then all columns from O to AG for that row change to Brown
fill color or
something like that. ( Actually if column N is a NO then its an indication
that rest of the columns for that row will be blank)

I thought of a crude code like the following but not able to convert it in
to proper VB language.

Private Sub Worksheet_Change(ByVal Target As Range)
dim noofrows as integer
noofrows = ?? ' Dunno a crisp formula for calculating the noofrows
For i = 3 to noofrows
If cells(noofrows,14) = "Yes" then
Range("N"&noofrows&":AG"&noofrows).interior.colori ndex = 6 ' Actually I know
that yellow is 6 But I prefer red or brown color to shade the culprit cells.
End if
Next noofrows
End Sub

Regards,
Hari
India