• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

VBA to change the equivalent cell based on the value on another sheet ...

David Evans

Active Member
Code:
Sub color_cols()

'The purpose of this code is to highlight an account with a value in All World Equity Funds
Dim rng As Range
Dim cell As Variant
Set rng = Sheets("Unagg").Range("C10:BY10")
For Each cell In rng
If cell.Value > 0 Then
  cell.EntireColumn.Interior.ColorIndex = 15
End If
Next
End Sub

I use this code to highlight a column with a value on Sheet("Unagg") - any of you Ninja Warriors got an idea of how I can use it to highlight the same column on Sheet("Other")? I know it's a Friday, but you've scared the West Indies into submission - so this will be easy!!

Dai
 
Code:
Sub color_cols()

'The purpose of this code is to highlight an account with a value in All World Equity Funds
Dim rng As Range
Dim cell As Variant
Set rng = Sheets("Unagg").Range("C10:BY10")
For Each cell In rng
If cell.Value > 0 Then
  cell.EntireColumn.Interior.ColorIndex = 15
  Sheets("Other").Columns(cell.Column).Interior.ColorIndex = 15 'Add this single line
End If
Next
End Sub
 
Back
Top