S
SusanB
Hi,
I've been working on a VBA program in Excel. The program lauches from a
button-click even in an excel.xls file. Seems to work well on my main
machine. When I copied the file for a co-worker to run on his machine,
he got an out of range error when the code started to perform
operations using data on the main sheet.
Here's the primary lines of code:
Dim thisBook As String
Dim thisSheet As String
'gets name of sheet and book from text boxes on main sheet (omitted
portion of code that checks to make sure these boxes have text in them)
thisBook = txtThisBook.Text
thisSheet = txtThisSheet.Text
'here's the line for out of range error
With Workbooks(thisBook).Worksheets(thisSheet).Range("N9:N500")
...
Debugging exercise indicates that the error is not the specific range.
It simply doesn't seem to recognize where this sheet is. I'm wondering
if there's some relative path it's referencing that simply isn't there
when the code is run on another machine. Do I need to include a line to
reference the path or a path property? Is this a common "feature" when
I use the code on another machine?
Any help would be very welcome!
Thanks
I've been working on a VBA program in Excel. The program lauches from a
button-click even in an excel.xls file. Seems to work well on my main
machine. When I copied the file for a co-worker to run on his machine,
he got an out of range error when the code started to perform
operations using data on the main sheet.
Here's the primary lines of code:
Dim thisBook As String
Dim thisSheet As String
'gets name of sheet and book from text boxes on main sheet (omitted
portion of code that checks to make sure these boxes have text in them)
thisBook = txtThisBook.Text
thisSheet = txtThisSheet.Text
'here's the line for out of range error
With Workbooks(thisBook).Worksheets(thisSheet).Range("N9:N500")
...
Debugging exercise indicates that the error is not the specific range.
It simply doesn't seem to recognize where this sheet is. I'm wondering
if there's some relative path it's referencing that simply isn't there
when the code is run on another machine. Do I need to include a line to
reference the path or a path property? Is this a common "feature" when
I use the code on another machine?
Any help would be very welcome!
Thanks