View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Dick Kusleika[_3_] Dick Kusleika[_3_] is offline
external usenet poster
 
Posts: 599
Default Apply Macro to Specific Column

WintonCW

You can use the EntireColumn property, but you may want to limit that a
little. Try something like this

Dim FndRng As Range

Set FndRng = ...cells.Find(...)

If Not FndRng Is Nothing Then
For Each Cell In
Intersect(FndRng.EntireColumn,FndRng.Parent.UsedRa nge).Cells
'Do stuff
Next Cell
End If

FndRng will be the cell that you 'found' and the EntireColumn property will
return the whole column. The Intersect method is used so that you don't go
through 65000 cells, just what's used in the spreadsheet.

--
Dick Kusleika
MVP - Excel
Excel Blog - Daily Dose of Excel
www.dicks-blog.com

"WintonCW" wrote in message
...
I have written a macro that highlights numbers in a given range (for each

c in <range)

However, I can't figure out how to set the range to only a specific column
I have found the column number using a cells.find(), but how do I set the

range?