Go Back   Trackpads Community > General Discussions > Computer and Technology > Microsoft Applications

Microsoft Applications Discussions about Windows and other MS Products such as Office

Reply
 
LinkBack Thread Tools
Old 06-16-2004, 00:53   #1 (permalink)
Jan
Civilians

 
Default FIND in VBA

Hi
I want to create a macro that selects column "A:A", and then "finds" a
cell with colourindex 24.
When I try to record such a macro, there always seems to be an "error"
in the recorded macro.
Can anyone help ?
 
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Trackpads Information
Click to Visit
Old 06-16-2004, 00:54   #2 (permalink)
Frank Kabel
Civilians

 
Default Re: FIND in VBA

Hi
try something like:
Sub Find_cell()
Dim RowNdx As Long
Dim LastRow As Long
LastRow = ActiveSheet.Cells(Rows.Count, "A").End(xlUp).row
For RowNdx = 1 to Lastrow
with Cells(RowNdx, "A")
if .interior.colorindex=24 then
msgbox "found cell"
.select
exit sub
End If
end with
Next RowNdx
End Sub


--
Regards
Frank Kabel
Frankfurt, Germany


Jan wrote:
> Hi
> I want to create a macro that selects column "A:A", and then "finds"

a
> cell with colourindex 24.
> When I try to record such a macro, there always seems to be an

"error"
> in the recorded macro.
> Can anyone help ?


 
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 06-16-2004, 00:54   #3 (permalink)
Alan Beban
Civilians

 
Default Re: FIND in VBA

Here's one way:

Sub test3010()
Dim iCell As Range
For Each iCell In Range("A:A")
If iCell.Interior.ColorIndex = 24 Then
iCell.Select
Exit For
End If
Next
End Sub

Alan Beban

Jan wrote:

> Hi
> I want to create a macro that selects column "A:A", and then "finds" a
> cell with colourindex 24.
> When I try to record such a macro, there always seems to be an "error"
> in the recorded macro.
> Can anyone help ?

 
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 06-16-2004, 00:56   #4 (permalink)
Jan
Civilians

 
Default Re: FIND in VBA

Thanks !! It works!

eyest@tiscali.be (Jan) wrote in message news:<ba7b2706.0404020640.a0aa923@posting.google.c om>...
> Hi
> I want to create a macro that selects column "A:A", and then "finds" a
> cell with colourindex 24.
> When I try to record such a macro, there always seems to be an "error"
> in the recorded macro.
> Can anyone help ?

 
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 06-16-2004, 00:56   #5 (permalink)
Dave Hawley
Civilians

 
Default Re: FIND in VBA

Hi Jan

I wouldn't re-invent the wheel. As you must have Excel 2000 or higher,
try

Application.FindFormat.Interior.ColorIndex = 26
Columns(1).Find(What:="", After:=Cells(1, 1), _
LookIn:=xlValues, LookAt:=xlPart, _
SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=True).Activate
End Sub

***** Posted via: http://www.ozgrid.com
Excel Templates, Training & Add-ins.
Free Excel Forum http://www.ozgrid.com/forum *****
 
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply

Bookmarks

Thread Tools

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

BB code is On
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
Find God to Find One's True Self Snowden Prayer & Religious Discussion 0 01-31-2008 10:10
[MV] Can someone help me find............. Chris Somers MV List 0 04-22-2006 00:28
Re: Find all and Sum Cutter Microsoft Applications 1 09-06-2005 12:00
Just want to find out How does one become MVP. =?Utf-8?B?QWpheSBLdW1hcg==?= Microsoft Applications 2 07-14-2004 15:55
Help with: =RIGHT(A2,LEN(A2)-FIND(" ",A2)) Stunners Microsoft Applications 6 06-16-2004 02:54


Community Information
Options
Quick Options
Trackpads Non-Commercial Ad
Copyright Information Click to Visit
Time
Server Time
All times are GMT -4. The time now is 13:03.
Copyright
Copyright Information
The header is based off of work by Vipixel.com and modified by this site. Trackpads and the Trackpads Logo are both Registered Trademarks of Jason Edwards and cannot be used without prior written permission.  The only exception is as a link back to this site. Trackpads is a private website run by a small legion of volunteers, 3 dogs, 12.5 cats and an army of small, super smart, bio-engineered mice with pointy hats and tutu's. Search Engine Friendly URLs by vBSEO 3.2.0 RC7
Archive Links
Archive Links
Page generated in 0.80557 seconds with 19 queries