Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 355
Default Need sample code

Hello -

I need sample code for the following scenarios:

If the color of the cell in column G is light green, then issue an error
message.
If the color of the cell in column G is white, make sure the corresponding
cell in column I is also white.

If there is a formula in the cell in column G, issue an error message.
If there is a Yes, No, or N/A in column G, make sure the corresponding cell
in Column I has text in it.

Any help will be greatly appreciated!

--
Sandy
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Need sample code


Sub CheckIt()

For each c in Range("g:g")
If c.interior.color= vbgreen then
MsgBox "Error-Greenland"
If c.interior.color=vbWhite then
c.offset(1,0).interior.color=vbwhite
If c.SpecialCells(xlCellTypeFormulas) then
Msgbox "Error-Formula!"
If c.SpecialCells(xlCellTypeFormulas,xlErrors) or _
c.SpecialCells(xlCellTypeFormulas,xlLogical)then
If c.offset(1,0).SpecialCells(xlCellTypeFormulas,xlTe xt) =false or
SpecialCells(xlCellTypeConstants,xlText)=False
MsgBox "Text required"
End if
End if
End if
End if
Next

End Sub


--
davidm
------------------------------------------------------------------------
davidm's Profile: http://www.excelforum.com/member.php...o&userid=20645
View this thread: http://www.excelforum.com/showthread...hreadid=400669

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 355
Default Need sample code

Hello David -

Thank you so much!!!
--
Sandy


"davidm" wrote:


Sub CheckIt()

For each c in Range("g:g")
If c.interior.color= vbgreen then
MsgBox "Error-Greenland"
If c.interior.color=vbWhite then
c.offset(1,0).interior.color=vbwhite
If c.SpecialCells(xlCellTypeFormulas) then
Msgbox "Error-Formula!"
If c.SpecialCells(xlCellTypeFormulas,xlErrors) or _
c.SpecialCells(xlCellTypeFormulas,xlLogical)then
If c.offset(1,0).SpecialCells(xlCellTypeFormulas,xlTe xt) =false or
SpecialCells(xlCellTypeConstants,xlText)=False
MsgBox "Text required"
End if
End if
End if
End if
Next

End Sub


--
davidm
------------------------------------------------------------------------
davidm's Profile: http://www.excelforum.com/member.php...o&userid=20645
View this thread: http://www.excelforum.com/showthread...hreadid=400669


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
Sample code to be fixed! Hilton Excel Discussion (Misc queries) 0 October 1st 08 03:22 PM
Software Expiration Code Sample Larry[_17_] Excel Programming 4 July 5th 05 08:41 PM
Registration Key Sample Code Larry[_17_] Excel Programming 0 July 5th 05 10:05 AM
Need Sample VBA Code Bill Sturdevant[_2_] Excel Programming 3 January 26th 05 10:25 PM
Debra's sample code to hide a Pivotitem Fred bon Excel Programming 0 August 7th 03 02:48 AM


All times are GMT +1. The time now is 08:19 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"