Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.setup
external usenet poster
 
Posts: 13
Default Condional Formatting with MACRO

Hello all
I would like to hightlight a row based on a value in a cell. I know it is
possible. I just don't know how to go about doing. i'd like to use vba if
possible.
In Column B1 and down, I have open, close, etc. If Open is selected, I would
like that row to be highlighted. Could someone help me out???

Thanks
  #2   Report Post  
Posted to microsoft.public.excel.setup
external usenet poster
 
Posts: 380
Default Condional Formatting with MACRO

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Const WS_RANGE As String = "B:B"

If Not Intersect(Target, rang(WS_RANGE)) Is Nothing Then
If Target.Value = "Open" Then
Target.EntireRow.Interior.ColorIndex = 38
Else
Target.EntireRow.Interior.ColorIndex = xlColorIndexNone
End If
End If

End Sub


This is worksheet event code, which means that it needs to be
placed in the appropriate worksheet code module, not a standard
code module. To do this, right-click on the sheet tab, select
the View Code option from the menu, and paste the code in.

--

HTH

Bob Phillips

(replace xxxx in the email address with gmail if mailing direct)

"Anift" wrote in message
...
Hello all
I would like to hightlight a row based on a value in a cell. I know it is
possible. I just don't know how to go about doing. i'd like to use vba if
possible.
In Column B1 and down, I have open, close, etc. If Open is selected, I

would
like that row to be highlighted. Could someone help me out???

Thanks



  #3   Report Post  
Posted to microsoft.public.excel.setup
external usenet poster
 
Posts: 13
Default Condional Formatting with MACRO

Hello Bob,
Thanks for the response, i really appreciate..
But there is something wrong in this code

I am getting error on line " If Not Intersect(Target, rang(WS_RANGE)) Is
Nothing Then"
Its highlighing the word "rang",
Can we do anything about it?

any help will be appreciated.

Thanks


"Bob Phillips" wrote:

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Const WS_RANGE As String = "B:B"

If Not Intersect(Target, rang(WS_RANGE)) Is Nothing Then
If Target.Value = "Open" Then
Target.EntireRow.Interior.ColorIndex = 38
Else
Target.EntireRow.Interior.ColorIndex = xlColorIndexNone
End If
End If

End Sub


This is worksheet event code, which means that it needs to be
placed in the appropriate worksheet code module, not a standard
code module. To do this, right-click on the sheet tab, select
the View Code option from the menu, and paste the code in.

--

HTH

Bob Phillips

(replace xxxx in the email address with gmail if mailing direct)

"Anift" wrote in message
...
Hello all
I would like to hightlight a row based on a value in a cell. I know it is
possible. I just don't know how to go about doing. i'd like to use vba if
possible.
In Column B1 and down, I have open, close, etc. If Open is selected, I

would
like that row to be highlighted. Could someone help me out???

Thanks




  #4   Report Post  
Posted to microsoft.public.excel.setup
external usenet poster
 
Posts: 10,593
Default Condional Formatting with MACRO

Sorry, missed an e

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Const WS_RANGE As String = "B:B"

If Not Intersect(Target, Range(WS_RANGE)) Is Nothing Then
If Target.Cells.Count = 1 Then
If Target.Value = "Open" Then
Target.EntireRow.Interior.ColorIndex = 38
Else
Target.EntireRow.Interior.ColorIndex = xlColorIndexNone
End If
End If
End If

End Sub




--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"Anift" wrote in message
...
Hello Bob,
Thanks for the response, i really appreciate..
But there is something wrong in this code

I am getting error on line " If Not Intersect(Target, rang(WS_RANGE)) Is
Nothing Then"
Its highlighing the word "rang",
Can we do anything about it?

any help will be appreciated.

Thanks


"Bob Phillips" wrote:

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Const WS_RANGE As String = "B:B"

If Not Intersect(Target, rang(WS_RANGE)) Is Nothing Then
If Target.Value = "Open" Then
Target.EntireRow.Interior.ColorIndex = 38
Else
Target.EntireRow.Interior.ColorIndex = xlColorIndexNone
End If
End If

End Sub


This is worksheet event code, which means that it needs to be
placed in the appropriate worksheet code module, not a standard
code module. To do this, right-click on the sheet tab, select
the View Code option from the menu, and paste the code in.

--

HTH

Bob Phillips

(replace xxxx in the email address with gmail if mailing direct)

"Anift" wrote in message
...
Hello all
I would like to hightlight a row based on a value in a cell. I know it

is
possible. I just don't know how to go about doing. i'd like to use vba

if
possible.
In Column B1 and down, I have open, close, etc. If Open is selected, I

would
like that row to be highlighted. Could someone help me out???

Thanks






  #5   Report Post  
Posted to microsoft.public.excel.setup
external usenet poster
 
Posts: 13
Default Condional Formatting with MACRO

Thanks bob, I figured it out..
thanks a lot, it helped
Kudos to u

"Bob Phillips" wrote:

Sorry, missed an e

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Const WS_RANGE As String = "B:B"

If Not Intersect(Target, Range(WS_RANGE)) Is Nothing Then
If Target.Cells.Count = 1 Then
If Target.Value = "Open" Then
Target.EntireRow.Interior.ColorIndex = 38
Else
Target.EntireRow.Interior.ColorIndex = xlColorIndexNone
End If
End If
End If

End Sub




--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"Anift" wrote in message
...
Hello Bob,
Thanks for the response, i really appreciate..
But there is something wrong in this code

I am getting error on line " If Not Intersect(Target, rang(WS_RANGE)) Is
Nothing Then"
Its highlighing the word "rang",
Can we do anything about it?

any help will be appreciated.

Thanks


"Bob Phillips" wrote:

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Const WS_RANGE As String = "B:B"

If Not Intersect(Target, rang(WS_RANGE)) Is Nothing Then
If Target.Value = "Open" Then
Target.EntireRow.Interior.ColorIndex = 38
Else
Target.EntireRow.Interior.ColorIndex = xlColorIndexNone
End If
End If

End Sub


This is worksheet event code, which means that it needs to be
placed in the appropriate worksheet code module, not a standard
code module. To do this, right-click on the sheet tab, select
the View Code option from the menu, and paste the code in.

--

HTH

Bob Phillips

(replace xxxx in the email address with gmail if mailing direct)

"Anift" wrote in message
...
Hello all
I would like to hightlight a row based on a value in a cell. I know it

is
possible. I just don't know how to go about doing. i'd like to use vba

if
possible.
In Column B1 and down, I have open, close, etc. If Open is selected, I
would
like that row to be highlighted. Could someone help me out???

Thanks






Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Help combining formatting in macro functions Slashman Excel Worksheet Functions 3 August 25th 06 04:41 AM
how do I email amacro? leo Excel Worksheet Functions 24 August 9th 06 02:47 PM
Conditional Formatting in Macro shantanu oak Excel Discussion (Misc queries) 2 July 14th 06 01:11 PM
Compiling macro based on cell values simonsmith Excel Discussion (Misc queries) 1 May 16th 06 08:31 PM
Search, Copy, Paste Macro in Excel [email protected] Excel Worksheet Functions 0 January 3rd 06 07:51 PM


All times are GMT +1. The time now is 08:39 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"