Hi.
I am trying to write a macro to copy some content from one workbook to another workbook (not different worksheets in the same workbook) and I am having some difficutly with which I need urgent help.
Se the following bits of code from my macro:
I get this error when the 3rd line tries to run: "Runtime Error 9. Subscript out of range"
I have verified that the variable sWorkbookName does contain the correct name of the workbook, and if I replace the reference to the varaibal 'sWorkbookName' in the 3rd line with the text string this variable contains, then it works as expected. But, when using a variable it does not work.
Can anyone tell me why this is causing problems, and tell me how to fix it please?
My memory is not as good as it should be, and neither is my memory.
I have forgotten more than I can remember
I am trying to write a macro to copy some content from one workbook to another workbook (not different worksheets in the same workbook) and I am having some difficutly with which I need urgent help.
Se the following bits of code from my macro:
Code:
Public sWorkbookName As String
sWorkbookName = ThisWorkbook.Name
Windows(sWorkbookFullName).Activate
I get this error when the 3rd line tries to run: "Runtime Error 9. Subscript out of range"
I have verified that the variable sWorkbookName does contain the correct name of the workbook, and if I replace the reference to the varaibal 'sWorkbookName' in the 3rd line with the text string this variable contains, then it works as expected. But, when using a variable it does not work.
Can anyone tell me why this is causing problems, and tell me how to fix it please?
My memory is not as good as it should be, and neither is my memory.
I have forgotten more than I can remember