Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 14
Default Making a row coloured if spacific data is anywhere in it

HI, im stuck on a bit of VBA for my little program i've written and
need some help!

I have a sheet of data which uses vlookup on another sheet to get 3
columns of information onto sheet 1, this works fine and also copies
and pastes special. the problem i have is if #NAME? appears in any
cell on that row the row needs to be filled with, or, the text turnt
into red.
If #NAME? doesnt appear and all the data is looked up then the row or
text in the row should appear green.

Now, this is where it gets a little more complicated as 1 of the
columns must take priority over another 1, say if LookedUp column 1
has data in it but LookedUp column 2 doesnt, thats fine so the row
should be coloured green.
if LookedUp column 1 has NO data and columns 2 OR 3 has NO data then
the row should be red.
if LookedUp column 1 has NO data and columns 2 AND 2 HAS data then the
row should be green.

If anyone cannot grasp the concept please dont worry ANY help is
appreciated :)

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 176
Default Making a row coloured if spacific data is anywhere in it

D-C writes:
Dare I suggest the straight-arrow:
Sub Sub1(pRow&)
Dim iColorIndex%
If Cells(pRow, 1) < "#NAME?" Then
iColorIndex = 4 ' green
ElseIf Cells(pRow, 2) < "#NAME?" And Cells(pRow, 3) < "#NAME?"
Then
iColorIndex = 4 ' green
Else
iColorIndex = 3 ' red
End If
Range(Cells(pRow, 1), Cells(pRow, 3)).Interior.ColorIndex =
iColorIndex
End Sub

DJ MC wrote:
HI, im stuck on a bit of VBA for my little program i've written and
need some help!

I have a sheet of data which uses vlookup on another sheet to get 3
columns of information onto sheet 1, this works fine and also copies
and pastes special. the problem i have is if #NAME? appears in any
cell on that row the row needs to be filled with, or, the text turnt
into red.
If #NAME? doesnt appear and all the data is looked up then the row or
text in the row should appear green.

Now, this is where it gets a little more complicated as 1 of the
columns must take priority over another 1, say if LookedUp column 1
has data in it but LookedUp column 2 doesnt, thats fine so the row
should be coloured green.
if LookedUp column 1 has NO data and columns 2 OR 3 has NO data then
the row should be red.
if LookedUp column 1 has NO data and columns 2 AND 2 HAS data then the
row should be green.

If anyone cannot grasp the concept please dont worry ANY help is
appreciated :)



----== Posted via Newsfeeds.Com - Unlimited-Unrestricted-Secure Usenet News==----
http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ Newsgroups
----= East and West-Coast Server Farms - Total Privacy via Encryption =----
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
Adding data to coloured cells Paul Sheppard Excel Discussion (Misc queries) 1 June 29th 06 09:16 AM
how do i get a pop up with reminders of things to do at spacific . abc answering service Excel Discussion (Misc queries) 2 December 27th 05 05:31 PM
Using data from coloured cells in a chart Mikey9131 Excel Worksheet Functions 1 November 26th 05 08:08 PM
Help with VBA code, making it spacific to one workbook polska2180 Excel Programming 0 September 27th 05 07:47 PM
copying cells to another workbook if the contain spacific words prwells Excel Programming 0 October 23rd 03 10:37 PM


All times are GMT +1. The time now is 11:00 PM.

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

About Us

"It's about Microsoft Excel"