Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 73
Default String with Cell Reference

I have a procedure that has to deal with a sequence of columns that grows
from week to week; i.e., this week I'm working with columns A thru AJ, next
week it'll be A thru AK. At one point in the code I need a string
representation of the first cell in each column, e.g., "A1", "B1", etc. I
dealt with that initially by hardcoding an array to hold all the strings, but
I'm sure there must be a property I can iterate through to get the first-cell
references for whatever column I'm dealing with -- on the first pass give me
"A1", on the second give me "B1", etc. Can someone please help me with that
property name and/or bit of code?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,441
Default String with Cell Reference

Larry,

Let's say that you have a ColumnCount variable

Sub TryNow()
Dim ColumnCount As Integer
Dim i As Integer

ColumnCount = 2

For i = 1 To ColumnCount
MsgBox Cells(1, i).Address(False, False)
Next i
End Sub


But there isn't any reason I can think of that would reguire a cell address in your code.... post
your code for further assistance ....

HTH,
Bernie
MS Excel MVP


"LarryP" wrote in message
...
I have a procedure that has to deal with a sequence of columns that grows
from week to week; i.e., this week I'm working with columns A thru AJ, next
week it'll be A thru AK. At one point in the code I need a string
representation of the first cell in each column, e.g., "A1", "B1", etc. I
dealt with that initially by hardcoding an array to hold all the strings, but
I'm sure there must be a property I can iterate through to get the first-cell
references for whatever column I'm dealing with -- on the first pass give me
"A1", on the second give me "B1", etc. Can someone please help me with that
property name and/or bit of code?



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 73
Default String with Cell Reference

You can stand down, Bernie; the .ADDRESS reference you provided works fine,
got rid of the array and several string variables.

"Bernie Deitrick" wrote:

Larry,

Let's say that you have a ColumnCount variable

Sub TryNow()
Dim ColumnCount As Integer
Dim i As Integer

ColumnCount = 2

For i = 1 To ColumnCount
MsgBox Cells(1, i).Address(False, False)
Next i
End Sub


But there isn't any reason I can think of that would reguire a cell address in your code.... post
your code for further assistance ....

HTH,
Bernie
MS Excel MVP


"LarryP" wrote in message
...
I have a procedure that has to deal with a sequence of columns that grows
from week to week; i.e., this week I'm working with columns A thru AJ, next
week it'll be A thru AK. At one point in the code I need a string
representation of the first cell in each column, e.g., "A1", "B1", etc. I
dealt with that initially by hardcoding an array to hold all the strings, but
I'm sure there must be a property I can iterate through to get the first-cell
references for whatever column I'm dealing with -- on the first pass give me
"A1", on the second give me "B1", etc. Can someone please help me with that
property name and/or bit of code?




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
how do I convert text string into a cell reference Dave Davis Excel Discussion (Misc queries) 4 May 18th 23 11:48 AM
Link or Cell Reference Within Text String [email protected] Excel Worksheet Functions 5 November 28th 07 04:52 PM
substitute the filename in a cell reference with a string in another cell. flummi Excel Discussion (Misc queries) 11 February 22nd 06 01:14 PM
How to get a cell reference of by searchig a text string? Najeeb Excel Discussion (Misc queries) 1 January 3rd 05 07:03 AM
reference to a cell within a string susan hayes Excel Programming 3 September 29th 04 10:46 AM


All times are GMT +1. The time now is 08:05 AM.

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"