Reference to Columns

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi , I am using the next line :

ActiveWorkbook.Worksheets("A").Columns((ConvertToLetter(inicol)) & ":" &
msConvertToLetter(endcol)).Select

Does exist some way for using only the Column Number ? I would prefer don´t
use the function ConvertToLetter.

Thank you in advance.
 
ActiveWorkbook.Worksheets("A").Columns((ConvertToLetter(inicol)) & ":" &
msConvertToLetter(endcol)).Select

Does exist some way for using only the Column Number ? I would prefer
don´t
use the function ConvertToLetter.

Well, you could always do what ConvertToLetter does directly in your code...

ActiveWorkbook.Worksheets("A").Columns(Chr(IniCol + 64) & ":" & Chr(EndCol +
64)).Select

Rick
 
ActiveWorkbook.Worksheets("A").Columns((ConvertToLetter(inicol)) & ":" &
msConvertToLetter(endcol)).Select

You could do it this way:

ActiveWorkbook.Worksheets("A").Range(Cells(1, inicol), Cells(65536,
endcol).Select
 
ActiveWorkbook.Worksheets("A").Columns((ConvertToLetter(inicol)) & ":" &
Well, you could always do what ConvertToLetter does directly in your
code...

ActiveWorkbook.Worksheets("A").Columns(Chr(IniCol + 64) & ":" & Chr(EndCol
+ 64)).Select

I can't help feeling there is a more direct method that I am simply
overlooking; but, anyway, here is another way to do it...

ActiveWorkbook.Worksheets("A").Columns(IniCol).Resize(Rows.Count, EndCol -
IniCol).Select

Rick
 
ActiveWorkbook.Worksheets("A").Columns(IniCol).Resize(Rows.Count, EndCol -
IniCol).Select

I forgot the +1...

ActiveWorkbook.Worksheets("Sheet1").Columns(IniCol).Resize(Rows.Count,
EndCol - IniCol + 1).Select

Rick
 
Using your variables Dimmed As Long:

Range(Columns(inicol), Columns(endcol)).Select

Mike F
 
See my responses Rick.

Mike Fogleman
Rick Rothstein (MVP - VB) said:
I can't help feeling there is a more direct method that I am simply
overlooking; but, anyway, here is another way to do it...

ActiveWorkbook.Worksheets("A").Columns(IniCol).Resize(Rows.Count, EndCol -
IniCol).Select

Rick
 
Thanks... see, I knew I was missing something obvious.

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

Back
Top