Search
Left Quote    Every day I get up and look through the Forbes list of the richest people in America. If I
- Robert Orben    
Right Quote
 
[login] | [Register]
 

VBA Prime Number Highlighter

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

Hello,

Below is my code to highlight a prime number.

Dogstar

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

3836

Down





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

13,932 Views
0 Total Comments
5 Rating of 5 (1 Votes)

Options

Blog Options  

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





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