PDA

View Full Version : search for word



oleg_v
01-18-2010, 03:01 AM
Hi

I am keeping my promise and attached a file.

my question is how can i search in the hole sheet1 and output in the messege box the name of the column where the word "page" repeats more than once.

i hope i explain my self well

Oleg

Bob Phillips
01-18-2010, 04:18 AM
Public Function InitialiseOutput()
Dim LastRow As Long
Dim col As Range

With ActiveSheet

For Each col In .UsedRange.Columns

If Application.CountIf(col, "page") > 1 Then

MsgBox "Column: " & col.EntireColumn.Address
End If
Next col
End With

End Function

oleg_v
01-18-2010, 04:23 AM
i am sorry

how i use it?

oleg_v
01-18-2010, 04:27 AM
Please disregard mi last thread.

In the message box i see "$c:$c"

can i get in message box just the letter "c"??

Bob Phillips
01-18-2010, 04:52 AM
Public Function InitialiseOutput()
Dim LastRow As Long
Dim col As Range

With ActiveSheet

For Each col In .UsedRange.Columns

If Application.CountIf(col, "page") > 1 Then

MsgBox "Column: " & Left$(col.EntireColumn.Address(, False), InStr(col.EntireColumn.Address(, False), ":") - 1)
End If
Next col
End With

End Function