|
-
Feb 7th, 2006, 08:35 AM
#1
Thread Starter
Hyperactive Member
Excel and Macros
Im trying to use:
VB Code:
Sub highlite()
If Range("V" & Int(Rnd * "10000")).Select Then
Rows(Int(Rnd * "10000") & ":" & Int(Rnd * "10000")).Select
Range("F" & Int(Rnd * "10000")).Activate
With Selection.Interior
.ColorIndex = 39
.Pattern = xlSolid
End With
End If
End Sub
in excel, to highlight a whole row, if i click on a cell in that row, then if I click on another row, it de-highlits back to how it was originally and highlights the new row! what am I ding wrong and is there a solution?
-
Feb 7th, 2006, 08:36 AM
#2
Re: Excel and Macros
Excel VBA question moved to Office Development
-
Feb 7th, 2006, 10:01 AM
#3
Member
Re: Excel and Macros
Try this:
VB Code:
Sub Highlite
ActiveCell.EntireRow.Select
With Selection.Interior
.ColorIndex = 39
.Pattern = xlSolid
End With
End sub
If you are trying to highlight rows that are in a certian range (eg rows 15-30)only then try:
VB Code:
Sub Highlite
If ActiveCell.Row > 15 And ActiveCell.Row < 30 Then
ActiveCell.EntireRow.Select
With Selection.Interior
.ColorIndex = 39
.Pattern = xlSolid
End With
End If
End sub
Hope this helps. If not please advise further and I will try again.
Last edited by Borg2of6; Feb 7th, 2006 at 10:10 AM.
-
Feb 7th, 2006, 10:43 AM
#4
Thread Starter
Hyperactive Member
Re: Excel and Macros
That worked fine thanks, i can work it myself from there
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|