Visual Basic Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreVisual Basic Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old December 5th, 2003, 02:30 PM
jakeaics jakeaics is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2003
Posts: 3 jakeaics User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Compare a cell to an input

I am trying to analyze each cell in a range (1 to 108) which is numbers in this format (200312 for yearmonth). If the cell number is less than 200312, I want it to be red. Each time I do the code it makes every cell in the range red regardless of number or if the cell is empty. Any suggestions?

Thanks.
Jake

Reply With Quote
  #2  
Old December 5th, 2003, 02:51 PM
Fisherman's Avatar
Fisherman Fisherman is offline
Inherits Programmer.Slacker
Dev Shed Regular (2000 - 2499 posts)
 
Join Date: Aug 2003
Location: Between my Id and your Ego
Posts: 2,176 Fisherman User rank is First Lieutenant (10000 - 20000 Reputation Level)Fisherman User rank is First Lieutenant (10000 - 20000 Reputation Level)Fisherman User rank is First Lieutenant (10000 - 20000 Reputation Level)Fisherman User rank is First Lieutenant (10000 - 20000 Reputation Level)Fisherman User rank is First Lieutenant (10000 - 20000 Reputation Level)Fisherman User rank is First Lieutenant (10000 - 20000 Reputation Level)Fisherman User rank is First Lieutenant (10000 - 20000 Reputation Level)Fisherman User rank is First Lieutenant (10000 - 20000 Reputation Level) 
Time spent in forums: 1 Week 1 Day 9 h 42 m 4 sec
Reputation Power: 111
Send a message via ICQ to Fisherman Send a message via AIM to Fisherman
Post your code for the text comparison and changing the cell forecolor - if it's in a sub, just post the whole sub- let us see what you are doing
__________________
Fisherman

"Any intelligent fool can make things bigger, more complex, and more violent. It takes a touch of genius -- and a lot of courage -- to move in the opposite direction." - A.Einstein

Reply With Quote
  #3  
Old December 5th, 2003, 04:23 PM
jakeaics jakeaics is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2003
Posts: 3 jakeaics User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Here's what I have so far:
Sub Scan()

Range("b1").Select

For RowIndex = 1 To 5

Worksheets("Sheet1").Cells(RowIndex, 1).Select

If Worksheets("Sheet1").Cells(RowIndex, 1).Select <= Range("b1") Then

With Selection.Interior
.ColorIndex = 3
.Pattern = xlSolid
End With

Else

End If

Next RowIndex

End Sub

What I would eventually like to have is a prompt requested yearmonth (200401 for instance), then comparing that to existing cells and turning those less than 200412 to red. The first one greater than 200412 would stop the macro. Thanks Fisherman for the assist.

Reply With Quote
  #4  
Old December 5th, 2003, 05:28 PM
Fisherman's Avatar
Fisherman Fisherman is offline
Inherits Programmer.Slacker
Dev Shed Regular (2000 - 2499 posts)
 
Join Date: Aug 2003
Location: Between my Id and your Ego
Posts: 2,176 Fisherman User rank is First Lieutenant (10000 - 20000 Reputation Level)Fisherman User rank is First Lieutenant (10000 - 20000 Reputation Level)Fisherman User rank is First Lieutenant (10000 - 20000 Reputation Level)Fisherman User rank is First Lieutenant (10000 - 20000 Reputation Level)Fisherman User rank is First Lieutenant (10000 - 20000 Reputation Level)Fisherman User rank is First Lieutenant (10000 - 20000 Reputation Level)Fisherman User rank is First Lieutenant (10000 - 20000 Reputation Level)Fisherman User rank is First Lieutenant (10000 - 20000 Reputation Level) 
Time spent in forums: 1 Week 1 Day 9 h 42 m 4 sec
Reputation Power: 111
Send a message via ICQ to Fisherman Send a message via AIM to Fisherman
I thought you were wanting to change the color of the font?

Reply With Quote
  #5  
Old December 5th, 2003, 07:36 PM
jakeaics jakeaics is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2003
Posts: 3 jakeaics User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
May I wasn't clear

I would like the code to select "A1", compare it to an input I provide (such as 200412) and if "A1" is less than 200412, the cell turns to red (actually the entire row). Once that is done, it cycles to cell "A2" and compares it to my input 200412 and does the same. Now, in cell "A3" the value would be (let's say) 200501, which then I would like the code to stop.

Any suggestions.

Wasn't an email. It was one from the website saying you replied.

Thanks.
Dave

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreVisual Basic Programming > Compare a cell to an input


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway