View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
NickHK[_3_] NickHK[_3_] is offline
external usenet poster
 
Posts: 415
Default find within a named range, then deselect the range

Bob,
OK, change
..EntireColumn.Width = 10
to
..ColumnWidth = 10

If you record a macro (ToolsMacroRecord New MacroOK) whilst you perform
your desired action, you can see the code required to achieve it.
Not always the most efficient code, but it will shown the correct object,
properties and syntax to use.

NickHK

"Bob Mouldy"
roups.com...
Thanks, this is really helpful.

I'm getting a debug error on the .EntireColumn line. I'm not a
programmer... is there something simple that's wrong about this line of
code? When I remove it, the command works fine (bold-facing the correct
header).

Sub Test()
'
' Test Macro
' Macro recorded 8/22/2006 by Bob Mouldy
'
' Keyboard Shortcut: Ctrl+Shift+T
'

Dim FindHeader As Range
Set FindHeader = Worksheets("Sheet1").Range("Headers").Find("Channe l")
With FindHeader
.Font.Bold = True
.EntireColumn.Width = 10
End With

End Sub

thx,
bob