Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Turning column count into a Column Letter

I have a macro where I am looking to be able to dynamically select
data based on how many rows and columns are filled in.
I have the count for the number of columns with data, but I need to
know how to turn that count # into a Column letter (like A, B, C) so
that I can then tell the macro the range to select.

How do I do that? I can find lots to tell me how to count columns,
but nothing that tells me how to translate that value into something
useful to me for my macro.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,934
Default Turning column count into a Column Letter

If you have a count, then just use the Resize property to create the range.
For example...

NumberOfRows = 5
NumberOfColumns = 9
StartAddress = "C3"
Range(StartAddress).Resize(NumberOfRows, NumberOfColumns).Select

--
Rick (MVP - Excel)


wrote in message
...
I have a macro where I am looking to be able to dynamically select
data based on how many rows and columns are filled in.
I have the count for the number of columns with data, but I need to
know how to turn that count # into a Column letter (like A, B, C) so
that I can then tell the macro the range to select.

How do I do that? I can find lots to tell me how to count columns,
but nothing that tells me how to translate that value into something
useful to me for my macro.


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default Turning column count into a Column Letter

On Oct 16, 10:19*am, wrote:
I have a macro where I am looking to be able to dynamically select
data based on how many rows and columns are filled in.
I have the count for the number of columns with data, but I need to
know how to turn that count # into a Column letter (like A, B, C) so
that I can then tell the macro the range to select.

How do I do that? *I can find lots to tell me how to count columns,
but nothing that tells me how to translate that value into something
useful to me for my macro.


function ColLtr(numb)
ColLtr = Chr(numb + 64)
end function
_____________________
Tom Lavedas
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,533
Default Turning column count into a Column Letter

Hi

If you have a fixed start cell, you can use something like this:

Range("A1").Resize(RowCount,ColumnCount)

or

Range("A1", Cells(RowCount, ColumnCount))

If you do not start from A1 you can use

Range("D5",Range("D5").Offset(RowCount-1,ColumnCount-1))

Hopes this helps.
....
Per

skrev i meddelelsen
...
I have a macro where I am looking to be able to dynamically select
data based on how many rows and columns are filled in.
I have the count for the number of columns with data, but I need to
know how to turn that count # into a Column letter (like A, B, C) so
that I can then tell the macro the range to select.

How do I do that? I can find lots to tell me how to count columns,
but nothing that tells me how to translate that value into something
useful to me for my macro.


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Turning column count into a Column Letter

Thanks to you both, you were a big help!!
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
COUNT unique letter in a column Brian Excel Worksheet Functions 6 May 8th 10 10:46 PM
Formular to count occurence of a number or letter in a column Bethrand Excel Worksheet Functions 2 September 12th 09 03:43 PM
How do I turn excel columns from column number to column letter? column Setting up and Configuration of Excel 1 April 29th 08 10:15 AM
How to replace column letter in refferences with a function using the old column letter? Dmitry Kopnichev Links and Linking in Excel 6 October 13th 05 09:09 AM
How to replace column letter in refferences with a function using the old column letter? Dmitry Kopnichev Excel Worksheet Functions 6 October 13th 05 09:09 AM


All times are GMT +1. The time now is 06:26 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"