Find method
Try this
Sub Find_First() Dim FindString As String Dim Rng As Range FindString = InputBox("Enter a Search value") If Trim(FindString) < "" Then Set Rng = Cells.Find(What:=FindString, _ After:=Range("IV" & Rows.Count), _ LookIn:=xlFormulas, _ LookAt:=xlWhole, _ SearchOrder:=xlByRows, _ SearchDirection:=xlNext, _ MatchCase:=False) If Not Rng Is Nothing Then MsgBox Rng.Column Else MsgBox "Can't find the word" End If End If End Sub -- Regards Ron de Bruin http://www.rondebruin.nl "benb" wrote in message ... I want to search an entire sheet for a cell containing a value then return the column number for that cell. I have tried variations of n=Activesheet.Find ([value], LookIn: xlValues, LookAt: xlWhole).Column, but any adaption I try gets a compile error. Any help? |
All times are GMT +1. The time now is 02:58 PM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com