|
|||||||||||||||||||||
|
|||||||
| Notices |
![]() |
|
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
||||
|
||||
|
VBA code line OK in earlier versions but not in XL 2007. Why?
Hi,
In an application I developed for someone, I have a line of code Code:
Range("M2") = "=MATCH(L2,'" & wbOld.Name & "'!$E:$E,FALSE)"
The application works fine on the Excel 2000 version on which it was developed, but not with the client's 2007 version. Has anyone come across any documentation which might explain why this won't work in 2007. (I've not yet acquired 2007) Thought I'd post it here first. If there's no feedback I'll move it over to the Excel 2007 forum. Usual TIA Richard B. |
|
#2
|
||||
|
||||
|
hi Richard
It seems fine in 2007. For testing I changed it slightly, this places the formula in a1 either in this workbook, or in another open workbook that is active. Code:
Option Explicit
Sub test()
Dim wbold As Workbook
Set wbold = ThisWorkbook
Range("a1") = "=MATCH(L2,'" & wbold.Name & "'!$E:$E,FALSE)"
End Sub
__________________
Hope that helps. RoyUK -------- For Excel consulting, free examples and tutorials visit my site Check out the free Excel Toolbar New members please read & follow the Forum Rules Remember to mark your questions Solved and rate the answer(s) Where to copy the code to Code Tags: Make your code easier for us to read |
|
#3
|
||||
|
||||
|
Hi Roy,
Thanks for the prompt reply. That's intriguing. Would you mind looking at the actual application if I upload it. It's fairly small with a workbook and a csv file supporting it, and check to see if it falls over on your system. Regards, Richard |
|
#4
|
||||
|
||||
|
No problem Richard
__________________
Hope that helps. RoyUK -------- For Excel consulting, free examples and tutorials visit my site Check out the free Excel Toolbar New members please read & follow the Forum Rules Remember to mark your questions Solved and rate the answer(s) Where to copy the code to Code Tags: Make your code easier for us to read |
|
#5
|
||||
|
||||
|
Thanks Roy,
Three zipped files attached. The 'Price Updater Template' is the one containing the macros. Click the button and a menu opens up, prompting you to load the 'Prices' file, then the 'Products' File, and when those two have been loaded, click the Update Data File button. It's at this stage that the user reports that it's falling over at the line: Code:
Range("M2") = "=MATCH(L2,'" & wbOld.Name & "'!$E:$E,FALSE)"
Regards, Richard |
|
#6
|
||||
|
||||
|
Hi Richard
I go the eror using yor uploaded files. however, when I converted the files to 2007 format (*.xlsm and *.xlsx) the code ran without errors. let me know if you want the converted books.
__________________
Hope that helps. RoyUK -------- For Excel consulting, free examples and tutorials visit my site Check out the free Excel Toolbar New members please read & follow the Forum Rules Remember to mark your questions Solved and rate the answer(s) Where to copy the code to Code Tags: Make your code easier for us to read |
|
#7
|
||||
|
||||
|
That's good news Roy, thanks for your assistance. I'll let the user know and ask him to do the same. Yes please email the converted template file. Can you briefly describe the process for converting the files. Is it just a question of opening the file and resaving with a .xlsm extension? Incidentally, what's the difference between .xlsm & .xlsx ? Sorry for such a basic question and hopefully it won't be too long before I upgrade to 2007 myself and become fully acquainted.
In the meantime I've been googling around and came across the following comment from Jon Peltier, which perhaps sheds a bit more light. I'd started to add the complete book.sheet reference to the cell but your solution should obviate the need for this. Presumably MS have built this translation into the conversion process. Many thanks once again. Richard Quote:
|
|
#8
|
||||
|
||||
|
Hi Richard
The extension *.xlsm is for workbooks containing macros, *.xlsx is for ordinary workbooks. Addins are saved in *.xlam format. When saving a *.xls file in 2007 you can choose which type to save as from the Office Button I'll mail the converted workbooks.
__________________
Hope that helps. RoyUK -------- For Excel consulting, free examples and tutorials visit my site Check out the free Excel Toolbar New members please read & follow the Forum Rules Remember to mark your questions Solved and rate the answer(s) Where to copy the code to Code Tags: Make your code easier for us to read |
![]() |
| Bookmarks |
New topics in Excel 2007 Help
|
|
|
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | Search this Thread |
| Display Modes | |
|
|