View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Rick Rothstein \(MVP - VB\)[_1940_] Rick Rothstein \(MVP - VB\)[_1940_] is offline
external usenet poster
 
Posts: 1
Default select column

First off, the functionality of the two statements you listed can be
accomplished with this single statement...

Columns("D").Hidden = True

Executing this statement when the column is already hidden will not generate
an error, so I am guessing you have other code following the code you showed
us which you do not wish to have executed if the column is already hidden.
Something like this should do what (I think) you want...

If Not Columns("D").Hidden Then
Columns("D").Hidden = True: Print "Hello"
'
' <<Your other code
'
End If

Rick



"geebee" (noSPAMs) wrote in message
...
hi,

turns out there were some merged cells. ok here is another problem... so
if
the column is ALREADY hidden, how can i add some error/process handling to
the following:

Columns("D").Select
Selection.EntireColumn.Hidden = True

thanks in advance,
geebee



"JLGWhiz" wrote:

Aside from possibly having merged cells somewhere in the column, I don't
know
what would cause that. However, as a sidepoint, if you are selecting the
entire column you don't need the attenuation colon. Just do

Columns("D").Select

You only need the attenuation colon if you are selecting more than one
column.

"geebee" wrote:

hi,

I have the following:
Columns("D:D").Select


for some reason columns C AND D are being selected?

why?

thanks in advance,
geebee