Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
how do I convert text string into a cell reference | Excel Discussion (Misc queries) | |||
Link or Cell Reference Within Text String | Excel Worksheet Functions | |||
substitute the filename in a cell reference with a string in another cell. | Excel Discussion (Misc queries) | |||
How to get a cell reference of by searchig a text string? | Excel Discussion (Misc queries) | |||
reference to a cell within a string | Excel Programming |