Left Quote    It is possible to store the mind with a million facts and still be entirely uneducated.
- Alec Bourne    
Right Quote
[login] | [Register]

VBA Prime Number Highlighter

by: dogstar
Composed on:
Aug., 01 2007 (9:06 pm)


Below is my code to highlight a prime number.


Sub Macro1()
' Macro1 Macro
' Macro recorded 1/3/2007 by Dogstar
' Keyboard Shortcut: Ctrl+p

Dim numSqr As Integer
Dim numRem

numSqr = (ActiveCell.Value) ^ 0.5

For i = 2 To numSqr

If ActiveCell.Value Mod i = 0 Then GoTo 3836 'not prime

Next i

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



End Sub
Sub Down()
ActiveCell.Offset(1, 0).Select
End Sub

No Comments for this page.

You Must be signed in or a member to comment.

Blog Stats

Blog Stats

0 Total Comments
5 Rating of 5 (1 Votes)


Blog Options  

· Login to Rate This Blog
· Report Abuse
· Login to Post a Comment
· Read more by this author
Digg This Blog! Bookmark This Blog Reddit: Bookmark This Blog BlinkList: Blink This Blog! YahooMyWeb BlogMarks: Add This Mark! Furl: Save This Blog Spurl: Mark This Blog

"" Copyright © 2002-2018; All rights lefted, all lefts righted.
Privacy Policy  |  Internet Rank