select column

  • Thread starter Thread starter geebee
  • Start date Start date
G

geebee

hi,

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


for some reason columns C AND D are being selected?

why?

thanks in advance,
geebee
 
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.
 
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
 
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

unprotected cells 2
select range 2
sum last rows 14
combine 1
simulate down arrow 1
columns 5
Delete Rows and Sheets 3
Find #N/A in column D 2

Back
Top