Question: Can the Address() function be used from within VBA?
Part 1) I have a spreadsheet where I use the Address function as a part of a formula within a cell without a problem but when I try to repeat what the formula does in VBA I get a compile error stating "Sub or Function not defined".
Here's an extract of my code:
Dim strForecastEnd As String
strForecastEnd = Address(17, 3)
Part 2) I actually want to get the column value from another sheet by searching for a string within a row and using that column. This works by placing the following formula in a cell:
=ADDRESS(17,MATCH('DATA SHEET'!C7,8:8,0))
However when I try to use the same approach from within VBA I get a compile error stating "Expected: Expression" and the first quote mark before the sheet name is highlighted. Here's my code:
Dim strForecastEnd As String
strForecastEnd = ADDRESS(17,MATCH('DATA SHEET'!C7,8:8,0))
I'm not sure if this function can't be used in VBA or if the syntax needs to be different. Any help would be greatly appreciated!
Thanks
Bookmarks