tfurnivall
Registered User.
- Local time
- Today, 15:15
- Joined
- Apr 19, 2012
- Messages
- 81
I have a database where I have a need to extract data into an Excel spreadsheet.
I am building the spreadsheet but need to construct some range values, using a numeric variable. For example:
This will construct a range address of A3, A4, A5, etc.
My problem is that the line where I use format(IndexRow ) as an expression causes a compile error.
OK - some details. The Excel spreadsheet is being manipulated via automation. This means that the code to manipulate the spreadsheet is running as part of an Access module (actually as an Access object).
This is valid VBA (Help on the VBA format function shows this to be the case, and thousands of lines of Excel VBA code reinforce this). Indeed, using this expression in the Immediate window:
works just fine.
My question is (or questions are):
1) Why doesn't this work?
2) Any workarounds that people might think of?
Yours, as ever, perplexed in Manhattan!
Tony
I am building the spreadsheet but need to construct some range values, using a numeric variable. For example:
Code:
const IndexCol="A"
dim IndexRow as long
dim RangeAddress as string
for IndexRow =3 to 8
rangeaddress=indexcol+format(IndexRow )
next r
My problem is that the line where I use format(IndexRow ) as an expression causes a compile error.
OK - some details. The Excel spreadsheet is being manipulated via automation. This means that the code to manipulate the spreadsheet is running as part of an Access module (actually as an Access object).
This is valid VBA (Help on the VBA format function shows this to be the case, and thousands of lines of Excel VBA code reinforce this). Indeed, using this expression in the Immediate window:
Code:
? IndexRow ,format(IndexRow )
My question is (or questions are):
1) Why doesn't this work?
2) Any workarounds that people might think of?
Yours, as ever, perplexed in Manhattan!
Tony